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


National Instruments Mainframe Chassis - NI-PXIe-1071 w/Warranty picture

National Instruments Mainframe Chassis - NI-PXIe-1071 w/Warranty

$690.00



Tektronix TM503 3 Bay Mainframe With FG 503, DM 502, PS 503 A Modules 120V AC picture

Tektronix TM503 3 Bay Mainframe With FG 503, DM 502, PS 503 A Modules 120V AC

$169.64



Agilent E1301B Mainframe  9-slots with multimeter, totalizer, and relay muxes picture

Agilent E1301B Mainframe 9-slots with multimeter, totalizer, and relay muxes

$200.00



National Instruments NI CompactRIO 8 Slot cRIO-9104 Backplane Mainframe picture

National Instruments NI CompactRIO 8 Slot cRIO-9104 Backplane Mainframe

$194.99



National Instruments NI PXI-1045 Chassis / 18-Slot 3U PXI Mainframe MONOR DENTS picture

National Instruments NI PXI-1045 Chassis / 18-Slot 3U PXI Mainframe MONOR DENTS

$489.00



NEWPORT 8800 PHOTONICS TEST SYSTEM MAINFRAME picture

NEWPORT 8800 PHOTONICS TEST SYSTEM MAINFRAME

$499.99







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