Click here to Skip to main content
15,887,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am trying to write web service client in android using android studio.
I tested client part using SoapUI it works fine. The SoapUI envelope is as follow:
XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.tibco.integration.jsc.com/">
   <soapenv:Header>
      <ws:Authentication>
         <B2BAccount>99999999</B2BAccount>
         <Password>99999999</Password>
         <CustomerId>00123456</CustomerId>
         <StateCode>01</StateCode>
         <PillarId>D</PillarId>
      </ws:Authentication>
   </soapenv:Header>
   <soapenv:Body>
      <ws:placeWSOrder>
         <WSOrder>1111111111111111</WSOrder>
         <OrderType>01</OrderType>
      </ws:placeWSOrder>
   </soapenv:Body>
</soapenv:Envelope>


What I have tried:

I am creating header as follows in java:
Java
// Add Authentication
elHeader[0] = new Element().createElement(strNameSpaceLocal, "Authentication");

// Add B2BAccount
Element elB2BAccount = new Element().createElement(strNameSpaceLocal, "B2BAccount");
elB2BAccount.addChild(Node.TEXT, "99999999");
elHeader[0].addChild(Node.ELEMENT, elB2BAccount);

// Add Password
Element elPassword = new Element().createElement(strNameSpaceLocal, "Password");
elPassword.addChild(Node.TEXT, "99999999");
elHeader[0].addChild(Node.ELEMENT, elPassword);

// Add CustomerId
Element elCustomerId = new Element().createElement(strNameSpaceLocal, "CustomerId");
elCustomerId.addChild(Node.TEXT, "00123456");
elHeader[0].addChild(Node.ELEMENT, elCustomerId);

// Add StateCode
Element elStateCode = new Element().createElement(strNameSpaceLocal, "StateCode");
elStateCode.addChild(Node.TEXT, "01");
elHeader[0].addChild(Node.ELEMENT, elStateCode);

// Add PillarId
Element elPillarId = new Element().createElement(strNameSpaceLocal, "PillarId");
elPillarId.addChild(Node.TEXT, "D");
elHeader[0].addChild(Node.ELEMENT, elPillarId);

ssEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

ssEnvelope.dotNet = true;
ssEnvelope.implicitTypes = true;
ssEnvelope.setAddAdornments(false);

ssEnvelope.headerOut = elHeader;


But it does not work.

I am getting following Exception error:
Sending Order ! at 01022016 202424
Calling sendRequest ! at 01022016 202424
Send Order Error 1:
org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <{http://schemas.xmlsoap.org/wsdl/}wsdl:definitions name='Untitled' targetNamespace='http://www.jsc.com/RetailWebService/'>@3:297 in java.io.InputStreamReader@22691c6a) at 01022016 202425


Could you please tell me what is wrong in above code.
I will appreciate it.

Thank you.

Dev
Posted
Updated 4-Feb-16 16:01pm
v4
Comments
Garth J Lancaster 4-Feb-16 20:37pm    
"But it does not work." .. can you appreciate from our point of view, out here, with no access to your screen/pc/error messages, how difficult it is to answer a question that says "But it does not work." - what/why/how does it 'not work' ? - you need to explain the desired outcomes simple as though they may seem in your mind, and show/describe to us what error messages or [state] occurs, so we can help.

Please edit your question above with more information describing what 'But it does not work.' actually means

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900