axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rickard Svensson" <srick...@home.se>
Subject Axis2 OMElement argument type mismatch
Date Thu, 17 May 2007 22:05:16 GMT

Hi all,


I'm using Jetty 6.1.1 as an embedded web-server, and Axis2 (1.1.1, also
tried 1.2).
Rpc style web services (with
org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver) works fine. But the
AXIOM (with org.apache.axis2.receivers.RawXMLINOutMessageReceiver) doesn't
seem to work. I receive the following error:

java.lang.IllegalArgumentException: argument type mismatch

The problem is in RawXMLINOutMessageReceiver, here:
OMElement result = (OMElement) method.invoke(
                    obj, new
Object[]{msgContext.getEnvelope().getBody().getFirstElement()});

If I deploy the exact same axis2.war-file in Tomcat, everything works fine.

My modified version of RawXMLINOutMessageReceiver (for extra logging) shows
me that the method signature is correct:

method.toString() = public org.apache.axiom.om.OMElement
se.kvadrat.jetty.MHSoapServer2Impl.transferXmlDocument2(org.apache.axiom.om.
OMElement)

method.getReturnType() org.apache.axiom.om.OMElement

envelope = <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header
/><soapenv:Body><ns1:transferXmlDocument2
xmlns:ns1="http://jetty.kvadrat.se/xsd"><ns1:param0><tns:symbol
xmlns:tns="http://jetty.kvadrat.se/xsd">test</tns:symbol></ns1:param0></ns1:
transferXmlDocument2></soapenv:Body></soapenv:Envelope>

body = <soapenv:Body
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><ns1:transferXmlDo
cument2 xmlns:ns1="http://jetty.kvadrat.se/xsd"><ns1:param0><tns:symbol
xmlns:tns="http://jetty.kvadrat.se/xsd">test</tns:symbol></ns1:param0></ns1:
transferXmlDocument2></soapenv:Body>

OMElement for method = <ns1:transferXmlDocument2
xmlns:ns1="http://jetty.kvadrat.se/xsd"><ns1:param0><tns:symbol
xmlns:tns="http://jetty.kvadrat.se/xsd">test</tns:symbol></ns1:param0></ns1:
transferXmlDocument2>


Axis2 is deployed using the following code:


         WebAppDeployer webAppDeployer = new WebAppDeployer();
         webAppDeployer.setContexts( jettyWebServer );
         webAppDeployer.setWebAppDir( "C:\\VSS\\utv\\Tools\\webappdir" );
         webAppDeployer.setExtract( true );
         webAppDeployer.setParentLoaderPriority( false );
         webAppDeployer.start();

         jettyWebServer.setStopAtShutdown( true );
         jettyWebServer.setSendServerVersion( true );

         jettyWebServer.start();
         jettyWebServer.join();



Services.xml:
---------------
<service name="MHSoapServer2" scope="application">
    <description>
        MH Soap Service
    </description>
    <operation name="transferXmlDocument">
        <messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> 
   </operation>

    <parameter name="ServiceClass"
locked="false">se.kvadrat.jetty.MHSoapServer2Impl</parameter>
</service>


WSDL:
--------
<wsdl:definitions xmlns:axis2="http://jetty.kvadrat.se"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:ns="http://jetty.kvadrat.se/xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://jetty.kvadrat.se"><wsdl:types><xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://jetty.kvadrat.se/xsd">
<xs:element name="transferXmlDocument2">
<xs:complexType>
<xs:sequence>
<xs:element name="param0" nillable="true" type="xs:anyType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="transferXmlDocument2Response">
<xs:complexType>
<xs:sequence>
<xs:element name="return" nillable="true" type="xs:anyType" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema></wsdl:types><wsdl:message
name="transferXmlDocument2Message"><wsdl:part name="part1"
element="ns:transferXmlDocument2" /></wsdl:message><wsdl:message
name="transferXmlDocument2ResponseMessage"><wsdl:part name="part1"
element="ns:transferXmlDocument2Response" /></wsdl:message><wsdl:portType
name="MHSoapServer2PortType"><wsdl:operation
name="transferXmlDocument2"><wsdl:input
message="axis2:transferXmlDocument2Message" /><wsdl:output
message="axis2:transferXmlDocument2ResponseMessage"
/></wsdl:operation></wsdl:portType><wsdl:binding
name="MHSoapServer2SOAP11Binding"
type="axis2:MHSoapServer2PortType"><soap:binding
transport="http://schemas.xmlsoap.org/soap/http" style="document"
/><wsdl:operation name="transferXmlDocument2"><soap:operation
soapAction="urn:transferXmlDocument2" style="document"
/><wsdl:input><soap:body use="literal" namespace="http://jetty.kvadrat.se"
/></wsdl:input><wsdl:output><soap:body use="literal"
namespace="http://jetty.kvadrat.se"
/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:binding
name="MHSoapServer2SOAP12Binding"
type="axis2:MHSoapServer2PortType"><soap12:binding
transport="http://schemas.xmlsoap.org/soap/http" style="document"
/><wsdl:operation name="transferXmlDocument2"><soap12:operation
soapAction="urn:transferXmlDocument2" style="document"
/><wsdl:input><soap12:body use="literal" namespace="http://jetty.kvadrat.se"
/></wsdl:input><wsdl:output><soap12:body use="literal"
namespace="http://jetty.kvadrat.se"
/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service
name="MHSoapServer2"><wsdl:port name="MHSoapServer2SOAP11port"
binding="axis2:MHSoapServer2SOAP11Binding"><soap:address
location="http://localhost:8080/axis2/services/MHSoapServer2"
/></wsdl:port><wsdl:port name="MHSoapServer2SOAP12port"
binding="axis2:MHSoapServer2SOAP12Binding"><soap12:address
location="http://localhost:8080/axis2/services/MHSoapServer2"
/></wsdl:port></wsdl:service></wsdl:definitions>


POST/SOAP Message, on the wire (using TCP monitor)
--------------------------------------------
POST /axis2/services/MHSoapServer2 HTTP/1.1

SOAPAction: "urn:transferXmlDocument2"

User-Agent: Axis2

Host: localhost:8449

Transfer-Encoding: chunked

Content-Type: text/xml; charset=UTF-8



16f

<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header />
      <soapenv:Body>
         <ns1:transferXmlDocument2 xmlns:ns1="http://jetty.kvadrat.se/xsd">
            <ns1:param0>
               <tns:symbol
xmlns:tns="http://jetty.kvadrat.se/xsd">test</tns:symbol>
            </ns1:param0>
         </ns1:transferXmlDocument2>
      </soapenv:Body>
   </soapenv:Envelope>0


Result
-------------
HTTP/1.1 500 Internal Server Error

Content-Type: text/xml; charset=utf-8

Transfer-Encoding: chunked

Server: Jetty(6.1.1)



133

<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header />
      <soapenv:Body>
         <soapenv:Fault>
            <faultcode>soapenv:Client</faultcode>
            <faultstring>argument type mismatch</faultstring>
            <detail />
         </soapenv:Fault>
      </soapenv:Body>
   </soapenv:Envelope>
0



My Web Service method
----------------------
package se.kvadrat.jetty;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class MHSoapServer2Impl implements MHSoapServer2 {


     public org.apache.axiom.om.OMElement
transferXmlDocument2(org.apache.axiom.om.OMElement element) {

        try {
            System.out.println("transferXmlDocument 2 CALLED!!!!");
            element.build();
element.detach();

String rootName = element.getLocalName();
System.out.println("Reading "+rootName+" element");

OMElement childElement = element.getFirstElement();
String personToGreet = childElement.getText();

OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace(
        "http://example1.org/example1", "example1");
OMElement method = fac.createOMElement("transferXmlDocumentResponse", omNs);
OMElement value = fac.createOMElement("greeting", omNs);
value.addChild(fac.createOMText(value, "Hello, "+personToGreet));
method.addChild(value);

return method;

        }
        catch (Exception e) {
            e.printStackTrace();
            return null;
        }

    }


        public String test(String element) {
            return "tjo";
        }


    public MHSoapServer2Impl() {
    }


}


Trace, using my modified version av RawXMLINOutMessageReceiver
(for extra logging)
----------------------------------------------
java.lang.IllegalArgumentException: argument type mismatch

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)

	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)

	at java.lang.reflect.Method.invoke(Method.java:324)

	at
org.apache.axis2.receivers.RawXMLINOutMessageReceiver.invokeBusinessLogic(Ra
wXMLINOutMessageReceiver.java:105)

	at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(Abstract
InOutSyncMessageReceiver.java:39) 



	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:497)

	at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HT
TPTransportUtils.java:328)

	at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:255)

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

	at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)

	at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)

	at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)

	at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)

	at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)

	at
org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49
)

	at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)

	at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)

	at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)

	at org.mortbay.jetty.Server.handle(Server.java:285)

	at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)

	at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:
765)

	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:710)

	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)

	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)

	at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)

	at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:4
75)

argument type mismatch


Best regards,
Rickard Svensson




---------------------------------------------------------------------
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