Hi PASQUER, 

At the end of this email, please find the WSDD file, and the sample
request and response for the message style service that comes with
axis/samples.

Just compile the MessageService.java class and place it in
WEB-INF/classes/samples/message directory. Copy-paste this WSDD entry in
your server-config.wsdd file. Restart the server.

See if this works for you.

If this (Element[] echoElements(Element [] elems)) works and 
If this (SOAPBodyElement [] method (SOAPBodyElement [] bodies) still
does not work for you. Please do send all the details, your WSDD entry
in server-config.wsdd and source. I'll try this myself, if possible.

///// Here is the entry in server-config.wsdd file

<service name="MessageService" provider="java:MSG" style="message"
use="literal">
  <parameter name="allowedMethods" value="echoElements"/>
  <parameter name="className" value="samples.message.MessageService"/>
  <parameter name="sendXsiTypes" value="false"/>
  <parameter name="sendMultiRefs" value="false"/>
 </service>

//// Here is the sample for message style service from Axis samples.

package samples.message ;

import org.w3c.dom.Element;

/**
 * Simple message-style service sample.
 */
public class MessageService {
    /**
     * Service method, which simply echoes back any XML it receives.
     * 
     * @param elems an array of DOM Elements, one for each SOAP body
element
     * @return an array of DOM Elements to be sent in the response body
     */ 
    public Element[] echoElements(Element [] elems) {
        return elems;
    }
}

//// Results after invoking this Web Service using WebServiceTester
---------------------
Executing: MessageService\echoElements
START TIME: Mon Jan 26 11:18:34 PST 2004
END TIME: Mon Jan 26 11:18:37 PST 2004
TEST RESULT: Test Passed
 Response Time :   1482ms
TTFB :   260ms
TTLB :   1482ms
Response Size :   409

HTTP Header   :   POST /axis/services/MessageService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related,
text/*
User-Agent: WST
Host: localhost:8080
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 468

===START REQUEST XML ENVELOPE===
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><SOAP-ENV:Body><ec
hoElements
xmlns="http://localhost:8080/axis/services/MessageService";>&lt;test&gt;&
lt;test1&gt;value1&lt;/test1&gt;&lt;test2&gt;value2&lt;/test2&gt;&lt;/te
st&gt;</echoElements></SOAP-ENV:Body></SOAP-ENV:Envelope>
===END REQUEST XML ENVELOPE===

===START RESPONSE XML ENVELOPE===
<?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><echoElements
xmlns="http://localhost:8080/axis/services/MessageService";><test
xmlns=""><test1>value1</test1><test2>value2</test2></test></echoElements
> </soapenv:Body> </soapenv:Envelope>
===END RESPONSE XML ENVELOPE===

Thanks,
Shrikant Wagh
QA Lead, HPP/Eprofile, HP

For those who are interested in Web Services testing:
-----------------------------------------------------
I found that WebServiceTester from Optimyz software is a very good tool
for testing any types of web services, and I'm great fan of this tool.
It supports all types of web services, and all simple and complex types
and it very usable than any other tool in the market I ever
used/evaluated. It automatically generates the SOAP requests and invokes
the intended web services. It can perform functional, regression and
load testing of web services. Result analysis and status reporting is
just wonderful.  I'll highly recommend this tool for testing web
services, saves lots of time and efforts in testing web services. For
more information visit http://www.optimyz.com. 

DISCLAIMER 
================================================================
THESE ARE MY PERSONAL VIEWS/OPINIONS AND DOES NOT REPRESENT HP, AND THE
INFORMATION PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
THE I/HP BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
INFORMATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

=================================================================

-----Original Message-----
From: PASQUER Arnaud DSI/SIFAC [mailto:[EMAIL PROTECTED]

Sent: Tuesday, January 20, 2004 5:45 AM
To: [EMAIL PROTECTED]
Subject: problem with message style and SOAPBodyElement signature

Hi all,
 
I've still having trouble getting document-style SOAP calls to work in
Axis with SOAPBodyElement [] myService (SOAPBodyElement [] bodies) :


SOAPFactoryImpl soapFactory=new SOAPFactoryImpl();
Name a=soapFactory.createName("A","icar","URI");
SOAPBodyElement bodyElement=new SOAPBodyElement (a);
SOAPElement b=bodyElement.addChildElement("B");
numClient.addTextNode("b");
SOAPElement c=bodyElement.addChildElement("C");
c.addTextNode("c");
SOAPBodyElement [] soapBodyElement = new SOAPBodyElement[1];
soapBodyElement[0]=bodyElement;
Vector elems = (Vector) call.invoke(soapBodyElement);

->java.lang.Exception: Body not found.

and log.debug(XMLUtils.ElementToString(soapBodyElement[0].getAsDOM())) :
<icar:A mlns:icar="URI"><icar:B>b</icar:B><icar:C>c</icar:C></icar:A>

and here's what my SOAP request looks like (from TCPMonitor):

...
SOAPAction: "" Content-Length: 417  <?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><icar:A
xmlns:icar="URI"><icar:B>b</icar:B><icar:C>c</icar:C></icar:A>
</soapenv:Body>
</soapenv:Envelope>


Why my body is not found?

Reply via email to