File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Web Services using soap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Services using soap" Watch "Web Services using soap" New topic

Web Services using soap

Mohammed Javeed Basha

Joined: May 22, 2012
Posts: 9
Client side web service having inputs and outputs like this, how to do invoke webservice from client side

<soapenv:Envelope xmlns:soapenv="" xmlns:loc="">
<loc: getCircleInfo>
</loc: getCircleInfo>

<S:Envelope xmlns:S="">
<ns2:getCircleInfoResponse xmlns:ns2="">
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
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

Joined: May 22, 2012
Posts: 9
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) {"HeaderHandler::handleMessage Entering");
boolean isSuccess = true;
SOAPMessage message = null;
Boolean outBoundProperty = (Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
message = smc.getMessage();

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

SOAPHeader header = null;
if(envelope.getHeader()!= null)
header = envelope.getHeader();
header = envelope.addHeader();
SOAPHeaderElement loc = (SOAPHeaderElement) header.addChildElement("loc", "Authentication");"HeaderHandler::handleMessage::ENVIRONMENT: "+getProp().getPropertyValue(FlyppISConstants.ENVIRONMENT));

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

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

} catch (Exception e) {

return isSuccess;

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

Can you please suggest any
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 642
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.


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
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

Joined: May 22, 2012
Posts: 9
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
I agree. Here's the link:
subject: Web Services using soap
It's not a secret anymore!