xml-soap-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erich Izdepski" <eizdep...@cysive.com>
Subject RE: how to work with the response object ?
Date Tue, 18 Jun 2002 12:14:59 GMT
there is RPC style SOAP and document style SOAP. RPC returns an object-
that's just the way it works. Document style deals with passing XML
documents around as SOAP input and output (not in apache, but in .net).
There is an in-between approach that may be what you want.
http://xml.apache.org/soap/features.html decribes an apache feature:
"Literal XML encoding: allows one to send XML elements (DOM
org.w3c.dom.Element objects) as parameters by embedding the literal XML
serialization of the DOM tree. No code needs to be written to support this
(see the addressbook demo to see a sample use of it)." Apache also supports
message clients/services that can work with XML directly. See the user's
guide for more.

Here's an article that talks about the two styles:

Erich Izdepski
Senior Software Engineer
Cysive, Inc.

-----Original Message-----
From: Tom Leuntjens [mailto:Tom.Leuntjens@korfina.be]
Sent: Tuesday, June 18, 2002 2:50 AM
To: soap-user@xml.apache.org
Subject: how to work with the response object ?

It took me a while to build a call that worked ...
But now I don't know how to handle the response ..

What is the easiest way to get the real response ?
I mean, the response is XML right ? why can't I simple read it and parse
I've tried different methods described in tutorials but I got the
feeling that this is no standard response  .. How do I proceed ?

This is the response (if I intercept with TCPMON)

> <?xml version="1.0" encoding="utf-8"?><soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><Version
> Identification="DATASWITCH" Major="2" Minor="3" Build="863" 
> Revision="14832" xmlns="http://xxx/core23" 
> /></soap:Header><soap:Body><PingResponse
> xmlns="http://xxx/core23"><PingResult
> Code="OK"><Message>Pong.</Message></PingResult></PingResponse>
> </soap:Bod
> y></soap:Envelope>

This is my code for the soap call 
What do I need to do after ?
resp = call.invoke (url, SOAPAction);

reading a printing the response value is simply empty ("") ... (which
seems logical since it's a string representation)

how to get it to XML ?

URL url = new URL "http://www.xxx.be/service/dataswitch23.asmx");

		String SOAPAction = "http://schemas.xxx.be/core23/Ping";
		SOAPMappingRegistry smr = new SOAPMappingRegistry();
		//BeanSerializer sd = new BeanSerializer ();
		StringDeserializer ss = new StringDeserializer();
		XMlDeserializer xi = new XMlDeserializer();

		smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
QName("http://schemas.xxx.be/core23", "PingResult"), null, null, xi);
		//smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
QName("http://schemas.xxx.be/core23", "Message"), null, null, ss);

		// create the transport and set parameters
		SOAPHTTPConnection st = new SOAPHTTPConnection();

		// create a non-validating, namespace aware doc-builder
 		DocumentBuilder db =
 		Document doc = db.newDocument();

 		// create header, declare namespace, add element to
 		Header header = new Header();
		Element version = doc.createElementNS("", "Version");
 		version.setAttribute("Identification", "SKARABEEPRO");
		version.setAttribute("Major", "0");
		version.setAttribute("Minor", "0");
		version.setAttribute("Revision", "0");
		version.setAttribute("Build", "0");

 		Vector entries = new Vector();

 		// set the entries and header

		// build the call.
		Call call = new Call ();
		call.setSOAPMappingRegistry (smr);
		call.setEncodingStyleURI ("Constants.NS_URI_SOAP_ENC");


View raw message