You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by gr...@inet.krakow.pl on 2004/09/23 13:12:58 UTC

Change calling service in Handler

I call in my clinet Service1, but I want call other WS, for example
CommonService (wchich is deployed)  and a file Service1.txt to be passed
as an argument for CommonService. I thought that I might write a handler
to be processed in global chain that substitutes Service1 with
CommonService and adds argument (path to Service1.txt) but that does not
change anything still is calling Service1. What am I doing wrong?

Soapmessage from client

<soapenv:Envelope
....
<soapenv:Body>
<ns2:method1 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soapencoding"
xmlns:ns2="service1">
<ns2:arg0 xsi:type="xsd:string">text 1</ns2:arg0>
</ns2:method1>
</soapenv:Body>
</soapenv:Envelope>

new soapmessage

<soapenv:Body>
<ns2:method2 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soapencoding"
xmlns:ns2="ComonService">
<ns2:arg0 xsi:type="xsd:string">text 2</ns2:arg0>
</ns2:method2>
</soapenv:Body>
</soapenv:Envelope>

My handler:

String newRequest = "<soapenv:Envelope
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"+
"<soapenv:Header>"+
"<ns1:BPEL soapenv:mustUnderstand=\"0\" xsi:type=\"xsd:string\"
xmlns:ns1=\"http://www\">1.1</ns1:BPEL>"+
"</soapenv:Header>"+
"<soapenv:Body>"+
"<ns2:method1 
soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"
xmlns:ns2=\"TestBPEL\">"+
"<ns2:arg0 xsi:type=\"xsd:string\">debil</ns2:arg0>"+
"</ns2:method1>"+
"</soapenv:Body>"+
"</soapenv:Envelope>";

ByteArrayInputStream istream = new
ByteArrayInputStream(newRequest.getBytes());
Message msg = new Message(istream, false);
msgContext.removeProperty(oldRequest);
msgContext.setMessage(msg);