• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Web Services using soap

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Client side web service having inputs and outputs like this, how to do invoke webservice from client side

Input:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loc="http://www.elite.com/sdp/spb/local">
<soapenv:Header/>
<loc:Authentication>
<Username>string1</Username>
<Password>string2</Password>
</loc:Authentication>
</soapenv:Header>
<soapenv:Body>
<loc: getCircleInfo>
<loc:msisdn>+918802561213</loc:msisdn>
</loc: getCircleInfo>
</soapenv:Body>
</soapenv:Envelope>

Output:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getCircleInfoResponse xmlns:ns2="http://www.elite.com/sdp/spb/local">
<ns2:CircleInformation>
<MSISDN>+918802561213</MSISDN>
<SubscriberType>Prepaid</SubscriberType>
<CircleID>4</CircleID>
<CircleName>DLHI</CircleName>
<Zone>null</Zone>
</ns2:CircleInformation>
</ns2:getCircleInfoResponse>
</S:Body>
</S:Envelope>
 
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the major SOAP implementations come with tools that create client-side Java code from the WSDL of the target WS. Check the documentation of whichever implementation you're using.
 
Mohammed Javeed Basha
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya i have done with jax-ws, ofcourse it generated some 6 files related to the client web service. But how and where to parse soapenvelope xml request and response, can you please provide me any example which parse the soapenvelope xml, or suggest any site for this particular example.
I'm having HeadHandler class, inside this class handleMessage(SOAPMessageContext smc) was like this
public boolean handleMessage(SOAPMessageContext smc) {

log.info("HeaderHandler::handleMessage Entering");
boolean isSuccess = true;
SOAPMessage message = null;
Boolean outBoundProperty = (Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if(outBoundProperty.booleanValue()){
message = smc.getMessage();
}


try {
SOAPEnvelope envelope = smc.getMessage().getSOAPPart().getEnvelope();

System.out.println("smc-->"+smc+"-->"+smc.getMessage()+"soapPart"+smc.getMessage().getSOAPPart());
System.out.println("smc.getMessage().getSOAPPart().getEnvelope()--->"+smc.getMessage().getSOAPPart().getEnvelope());
envelope.addNamespaceDeclaration("loc","http://www.wipro.com/sdp/spb/local");
SOAPHeader header = null;
System.out.println("envelope-->"+envelope);
if(envelope.getHeader()!= null)
header = envelope.getHeader();
else
header = envelope.addHeader();
SOAPHeaderElement loc = (SOAPHeaderElement) header.addChildElement("loc", "Authentication");
log.info("HeaderHandler::handleMessage::ENVIRONMENT: "+getProp().getPropertyValue(FlyppISConstants.ENVIRONMENT));


SOAPElement username = loc.addChildElement("Username");
username.addTextNode(strUsername);

SOAPElement password = loc.addChildElement("Password");
password.addTextNode(strPassword);


} catch (Exception e) {
e.printStackTrace();
}

return isSuccess;
}

Here envelope itself getting null value and it leads to error, unable to get header.

Can you please suggest any
 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well, with the quality of question I am assuming you are way far away from deploying and executing a webserivce of this complexity.

I would suggest you learn it step by step, understand the basics of WS and its different components + architecture. Getting a book is best option but there are tons of resources on web, just Google.

In my opinion even if you resolve this issues, it will not help much to understand whats going on.

Well, I may be wrong, I jumped to this conclusion by looking at the difference in quality of your question to complexity of the code.

-P
 
Ulf Dittmer
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You wouldn't parse anything - the SOAP stack does that for you. Your code interacts with the generated classes purely on the level of Java objects and method calls.
 
Mohammed Javeed Basha
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually i have created the webservice, but need to provide soapenvelope request as input and need to retrieve soapenvelope response as output.
Can you please tell me any website name to refer this kind of example, ulf
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic