BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-10-2008, 04:14 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2008
Model: 8310
PIN: N/A
Carrier: Informatico
Posts: 56
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default soap and web services

Please Login to Remove!

HI

When I execute the next code, the emulator returns me the error "not authorized to access..". In the virtual directroy contains all permissions, but since Internet Explorer goes correctly. This is the code of the midlet and the text that returns me the web service since IE. thanks.

String soapAction = "http://tempuri.org/HelloWorld";
String serviceUrl = "http://localhost/WEB_SERVICE/Service.asmx";
String serviceNamespace ="http://tempuri.org/WEB_SERVICE/HelloWorld";

HttpTransport transport = null;
SoapObject soap = new SoapObject(serviceNamespace, "HelloWorld");
//SoapObject soap = new SoapObject("http://tempuri.org/","HelloWorld");

transport = new HttpTransport(serviceUrl, soapAction);
//transport.setUrl("http://localhost/WEB_SERVICE/ service.asmx");
//transport.setSoapAction("http://tempuri.org/Hel loWorld");
transport.debug = true;
Object result = transport.call(soap);

StringItem item = new StringItem("Resultado: ", result.toString());
formulario.append(item);
} catch (Exception e) {
formulario.append(e.toString());
e.printStackTrace();
}


SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.

POST /WEB_SERVICE/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/HelloWorld"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlnssi="http://www.w3.org/2001/XMLSchema-insta nce" xmlnssd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envel ope/">
<soap:Body>
<HelloWorld xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlnssi="http://www.w3.org/2001/XMLSchema-insta nce" xmlnssd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envel ope/">
<soap:Body>
<HelloWorldResponse xmlns="http://tempuri.org/">
<HelloWorldResult>string</HelloWorldResu lt>
</HelloWorldResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.

POST /WEB_SERVICE/Service.asmx HTTP/1.1
Host: localhost
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlnssi="http://www.w3.org/2001/XMLSchema-insta nce" xmlnssd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-enve lope">
<soap12:Body>
<HelloWorld xmlns="http://tempuri.org/" />
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlnssi="http://www.w3.org/2001/XMLSchema-insta nce" xmlnssd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-enve lope">
<soap12:Body>
<HelloWorldResponse xmlns="http://tempuri.org/">
<HelloWorldResult>string</HelloWorldResu lt>
</HelloWorldResponse>
</soap12:Body>
</soap12:Envelope>
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.

POST /WEB_SERVICE/Service.asmx/HelloWorld HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length


HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">string</string& gt;
Offline  
Old 04-10-2008, 04:28 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you started the MDS along with emulator.?

if yes, please check for settings for the soap in the advanced options of the emulator.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.