The SOAP specification does not define the behavior for how to request
multiple operations in a single SOAP request. Therefore the folks at WS-I
decided to disallow it. The WS-I Basic Profile specifies that a SOAP Body
may contain only one child element (which indicates the operation). This is
true of both RPC and Document style services.

Most SOAP implementations (including Axis) ignore any additional child
elements of the SOAP Body. 

I suggest that you change the granularity of your interface so that you can
invoke both functions through a single operation request.

Anne

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 14, 2004 5:48 AM
To: [EMAIL PROTECTED]
Subject: Q: multiple methods in a single SOAP request?


I was under the impression that a SOAP server should be able to
execute multiple methods in a single SOAP call, but I do not seem
to get it working.

This code (java/SAAJ)

String namespace = "http://mynamespace";;
String endpoint = "http://myserver/myservice";;
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
SOAPBody body = msg.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
body.addBodyElement(soapFactory.createName(
                                "GetServerVersion","ns1", namespace));
body.addBodyElement(soapFactory.createName(
                                "GetLocation","ns1", namespace));
SOAPConnectionFactory cf = SOAPConnectionFactory.newInstance();
SOAPConnection connection = cf.createConnection();
SOAPMessage reply = connection.call(msg, endpoint);

gets me this SOAP message:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns1:GetServerVersion xmlns:ns1="http://mynamespace"/>
<ns1:GetLocation xmlns:ns1="http://mynamespace"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

But my server only executes the first method.
Should I do something different in my client, or is this completely
impossible...?

For some reason, I thought that a document style
SOAP service call could include multiple method calls. While trying to get
it working, I started looking in the SOAP specs again, and do not realy
find convining evidence in favor or against my assumption. I also do not
remember why I thought this would be possible, I
suspect having read this in an early SOAP draft document or so...

-- lode


----------------------------------------------------------------------------
------
Plaats je zoekertjes GRATIS op AdValvas
Placez votre petite annonce GRATUITEMENT sur AdValvas
http://www.advalvas.be




----------------------------------------------------------------------------
------
Plaats je zoekertjes GRATIS op AdValvas
Placez votre petite annonce GRATUITEMENT sur AdValvas
http://www.advalvas.be

Reply via email to