BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-14-2008, 01:50 PM   #1
SilverSkeleton
New Member
 
Join Date: Apr 2008
Model: 8120
PIN: N/A
Carrier: NONE
Posts: 3
Talking (JDE) - Soap Request to a .NET web service.

Please Login to Remove!

hi, i have this code on mi BB app..i know is not perfect code but is all i have understand so far...im triying just to do a connection whit ...and send 2 parameters ass well as cathc them back.(im just starting whit JDE pls dont laugh).This is mi closes aproach..can some help me alittle any comment or sugestion will be appreciate thx in advance..

:bb:
String soapAction = "http://tempuri.org/Login";
String serviceUrl = "http://myHost.com/webservice/webservice.asmx";
String serviceNamespace = "http://tempuri.org/";

HttpTransport transport = null;
SoapObject soap1 = new SoapObject(serviceNamespace,"Login");
transport = new HttpTransport(serviceUrl,soapAction);
transport.debug = true;
Object result = transport.call(soap1);

StringItem item = new StringItem(result.toString());

--------------------------------------------------------------------------
SOAP 1.1
POST /webservice/webservice.asmx HTTP/1.1
Host: netarriba.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Login"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Login xmlns="http://tempuri.org/">
<user>string</user>
<pwd>string</pwd>
</Login>
</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 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<LoginResponse xmlns="http://tempuri.org/">
<LoginResult>
<string>string</string>
<string>string</string>
</LoginResult>
</LoginResponse>
</soap:Body>
</soap:Envelope>

Last edited by SilverSkeleton; 04-15-2008 at 12:06 PM..
Offline  
Old 04-15-2008, 09:12 AM   #2
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

Try :

SoapObject requestMessage = new SoapObject("http://tempuri.org/", "Login");
requestMessage.addProperty("user",the_value_of_the _user);
requestMessage.addProperty("pwd",the_value_of_the_ password);
Object obj = transport.call(requestMessage);
String Result = obj.toString();
Offline  
Old 04-15-2008, 11:00 AM   #3
SilverSkeleton
New Member
 
Join Date: Apr 2008
Model: 8120
PIN: N/A
Carrier: NONE
Posts: 3
Default

Thx alot for your reply "goulamass". (Im cheking this right now) I forgot tell im using Ksoap library.
I get a syntax error in this two lines of code:

try{
String soapAction = "http://tempuri.org/Login";
String serviceUrl = "http://www.xxxxxxxxxx.com/ws/webservice.asmx";
String serviceNamespace = "http://tempuri.org/";

SoapObject requestMessage = new SoapObject(serviceNamespace, "Login");
requestMessage.addProperty("user",the_value_of_the _user); <----What would be my value of "user"
requestMessage.addProperty("pwd",the_value_of_the_ password); <----What would be my value of "pass"
HttpTransport transport = null;
transport = new HttpTransport(serviceUrl,soapAction);
Object obj = transport.call(requestMessage);
String Result = obj.toString();

}catch(IOException ioe){}



"Imagination is more important than knowledge." Albert Einstein

Last edited by SilverSkeleton; 04-15-2008 at 05:42 PM.. Reason: Final code.
Offline  
Old 04-15-2008, 12:35 PM   #4
SilverSkeleton
New Member
 
Join Date: Apr 2008
Model: 8120
PIN: N/A
Carrier: NONE
Posts: 3
Default SoapObject.addProperty

I took this from KSOAP API Documentation:

SoapObject addProperty(java.lang.String name, java.lang.Object value)

Adds a property (parameter) to the object. This is essentially a sub element.
Parameters:
name - The name of the property.
value - the value of the property.

My question is: what would be my "java.lang.Object value" ? of my example.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


LCD Digital Multimeter Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meter picture

LCD Digital Multimeter Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meter

$9.95



Genuine Husqvarna 532122822 Ammeter 15 AMP Fits Craftsman AYP 121433X 122822X picture

Genuine Husqvarna 532122822 Ammeter 15 AMP Fits Craftsman AYP 121433X 122822X

$19.58



5/10Pcs DC 100V 10A Digital Voltmeter Ammeter LED Amp Volt Meter Current Gauge picture

5/10Pcs DC 100V 10A Digital Voltmeter Ammeter LED Amp Volt Meter Current Gauge

$21.98



Digital Multimeter AC DC Voltmeter Ammeter Ohmmeter Volt Tester Meter DM850 picture

Digital Multimeter AC DC Voltmeter Ammeter Ohmmeter Volt Tester Meter DM850

$7.95



Digital Multimeter Voltmeter Ammeter AC DC Volt Ohmmeter Tester Meter Auto Range picture

Digital Multimeter Voltmeter Ammeter AC DC Volt Ohmmeter Tester Meter Auto Range

$9.95



Digital Multimeter Voltmeter BSIDE AC DC Ammeter Ohmmeter Volt Meter Tester Ohm picture

Digital Multimeter Voltmeter BSIDE AC DC Ammeter Ohmmeter Volt Meter Tester Ohm

$24.98







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