I'm not sure if anyone replied to this email or not but anyways....
>From the Javadoc of Call.invoke(Object[] params) :
"For Messaging (ie. non-RPC) the params argument should be an array
of SOAPBodyElements. <b>All</b> of them need to be SOAPBodyElements,
if any of them are not this method will default back to RPC. In the
Messaging case the return value will be a vector of SOAPBodyElements."
This is also consistent with the JAX-RPC spec. Hence to invoke your
doc/literal web-service, your client code should look like:
org.w3c.dom.Document = ......
org.w3c.dom.Element documentRoot = doc.getDocumentElement();
Call call = ......
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
org.apache.axis.message.SOAPBodyElement soapBodyElement = new
org.apache.axis.message.SOAPBodyElement(documentRoot);
Vector returnDoc = (Vector)call.invoke(new
SOAPBodyElement[]{soapBodyElement});
- Junaid
[EMAIL PROTECTED]
To: [EMAIL PROTECTED]
07/01/2003 09:44 cc:
AM Subject: Problem invoking
Document/literal with XML Document as parameter
Please respond to
axis-user
Hi,
i am a newbie to axis and have a problem with calling a soap web service
with a prebuild XML Document as a parameter and hope someone can give me
a hint.
The service i implemented uses message style document/literal and expects
a XML Document as parameter. The service was tested and works fine.
A working and i think correct SOAP request to the service should look
like this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:BookingRequest xmlns:m="http://my.domain.org/booking">
<location>String</location>
<startDate>1998-08-13</startDate>
<endDate>1998-08-14</endDate>
</m:BookingRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Now i want to write a new client which invokes the service with a prebuild
XML Document like this:
<m:BookingRequest xmlns:m="http://my.domain.org/booking">
<location>City</location>
<startDate>2001-08-13</startDate>
<endDate>2001-08-15</endDate>
</m:BookingRequest>
I use the following part of code to invoke the service:
.
.
.
Document doc = ...........
call.setOperationStyle(Style.DOCUMENT);
call.setEncodingStyle("literal");
Document result = (Document) call.invoke( new Object[] { doc } );
.
.
.
The problem now is, that the generated SOAP request has a additional node
for the parameter, which wrapped the prebuild XML document. The result
is a org.xml.sax.SAXException on the server site. Here is the generated
SOAP request:
<?xml version="1.0" encoding="UTF-8"?>
<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:Body>
<ns1:arg0 xmlns:ns1="http://my.domain.org/booking">
<m:BookingRequest xmlns:m="http://my.domain.org/booking">
<location>City</location>
<startDate>2001-08-13</startDate>
<endDate>2001-08-15</endDate>
</m:BookingRequest>
</ns1:arg0>
</soapenv:Body>
</soapenv:Envelope>
Is is possible to prevent the generation of the additional
argument/parameter node ?
Many thanks to all hints and helps.
Sven Offermann
--
60% Onlinekosten sparen!
Jetzt Premium Mitglied bei freenet.de werden und mit dem
Tarifnavigator guenstiger surfen.
http://www.freenet.de/tipp/premium/tarif/index.html