axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KaySquare <kz...@uni-muenster.de>
Subject howto: construct a sopa-request fully manually!!
Date Tue, 17 Apr 2007 18:08:01 GMT

Hi,
i'm looking for a solution to build a soap-request completely by hand...
Reason for this is that wsdl2java constructs an invalid stub from the
(existing) wsdl-file from a legacy-system (I used Eclipse/Lomboz and the
code which was generated ignores parameters of any response-message... I
dont know why).

I managed most of the task using this code:

<snip: java code, using apache axis1>

String endpoint =
	"http://**hidden**";

Service  webservice 	 = new Service();
Call     webserviceCall  = (Call) webservice.createCall();

webserviceCall.setTargetEndpointAddress( new java.net.URL(endpoint) );

webserviceCall.setOperationName(new QName(null, "IPS_SubServiceCall"));
webserviceCall.setEncodingStyle( "http://schemas.xmlsoap.org/soap/encoding/"
);
webserviceCall.setOperationStyle("rpc"); 

webserviceCall.addParameter("SID", org.apache.axis.Constants.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
webserviceCall.addParameter("SERVICE", org.apache.axis.Constants.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
webserviceCall.addParameter("SUBSERVICE",
org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
// THAT's WRONG:
webserviceCall.addParameter("REQUESTMAP",
org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);

webserviceCall.setReturnType(org.apache.axis.Constants.XSD_STRING);

Object o = (Object) webserviceCall.invoke( new Object[] {sessionID, service,
subservice, "requestmap"} );
MessageContext mc = webserviceCall.getMessageContext();
String response = mc.getResponseMessage().getSOAPPartAsString();
StringReader strReader = new StringReader(response); 
InputSource inputsrc = new InputSource(strReader); 
Document document = XMLUtils.newDocument(inputsrc);
/* nothing to scan for (here)
XPath xpath = XPathFactory.newInstance().newXPath();
String expressionForERRORCODE = "//ERRORCODE";
String ips_errorcode = xpath.evaluate(expressionForERRORCODE, document);
*/
</java-code>

I need to construct the part of the requestmap by hand, as I don't know, how
to consturct an rpc-encoded array of a user-defined type...
It should look like this:

<snip: SOAP>
<CALLER s:type="y:string">USER</CALLER> 
<SID s:type="y:string">TEST:1264335072</SID> 
<SERVICE s:type="y:string">METASEARCH</SERVICE> 
<SUBSERVICE s:type="y:string">INITSEARCH</SUBSERVICE> 
<REQUESTMAP s:type="ns1:Map" xmlns:ns1="http://xml.apache.org/xml-soap"> 
<item>
 <key s:type="y:string">TEMPLATE</key>
 <value s:type="y:string">FALSE</value>
</item> 
<!-- probably even more items -->
<item>
 <key s:type="y:string">COUNT</key>
 <value s:type="y:string">20</value>
</item> 
<item>
<key s:type="y:string">START</key>
<value s:type="y:string">0</value>
</item>
</REQUESTMAP> 
</m:IPS_SubServiceCall> 
</E:Body> 
</E:Envelope>
</soap>

The complete wsdl-file could be downloaded from here: 
http://www.file-upload.net/download-251262/wsdl.wsdl.html
http://www.file-upload.net/download-251262/wsdl.wsdl.html 

THANK YOU for your help - I'm really stuck here...

Kay²
-- 
View this message in context: http://www.nabble.com/howto%3A-construct-a-sopa-request-fully-manually%21%21-tf3595129.html#a10042955
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message