Hello,
I'd like to run axis2 embedded in a java program, and decided to do some
tests.
Running this application gives me the following log4j messages:
Required MessageReceiver couldn't be found, thus, default MessageReceiver
has
been used
Listening on port 8080
sending a soap request gives (without much surprise) an exception, stating:
Message Receiver not found for AxisOperation: echo
Browsing through the various api's (seems like the syntax of 'createservice'
is changed recently, lots of outdated docs on the net) doesn't give me much
options.
I found out that the exception is thrown if there is no entry in the 'mrMap'
(see code below) for the right mep.
messageReceiverClassMap.get(mep) == null
so my guess is, i dont use the right key in the Map, the docs give me
exactly
these values, and i couldn't find any more information.
Thanks in advance,
Bas
Here is some code:
package test;
import java.util.HashMap;
import java.util.Map;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver;
import org.apache.axis2.rpc.receivers.RPCMessageReceiver;
import org.apache.axis2.transport.http.SimpleHTTPServer;
public class Test {
public static void main(String[] args) throws Exception {
ConfigurationContext context = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(null, null);
Map mrMap = new HashMap();
mrMap.put("http://www.w3.org/2006/01/wsdl/in-only",
RPCInOnlyMessageReceiver.class.newInstance());
mrMap.put("http://www.w3.org/2006/01/wsdl/in-out",
RPCMessageReceiver.class.newInstance());
AxisService service =
AxisService.createService(Echo.class.getName(),
context.getAxisConfiguration(),
mrMap, "http://test.com", "http://test2.com",
ClassLoader.getSystemClassLoader());
context.getAxisConfiguration().addService(service);
SimpleHTTPServer server = new SimpleHTTPServer(context,
8080);
server.start();
}
}
=======================
package test;
public class Echo {
public String echo(String in) {
return in;
}
}
=======================
the wsdl generated:
<wsdl:definitions targetNamespace="http://test.com">
?
<wsdl:types>
?
<xs:schema attributeFormDefault="qualified"
elementFormDefault="unqualified"
targetNamespace="http://test2.com">
?
<xs:element name="echo">
?
<xs:complexType>
?
<xs:sequence>
<xs:element minOccurs="0" name="in" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
?
<xs:element name="echoResponse">
?
<xs:complexType>
?
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
?
<wsdl:message name="echoRequest">
<wsdl:part name="parameters" element="ns0:echo"/>
</wsdl:message>
?
<wsdl:message name="echoResponse">
<wsdl:part name="parameters" element="ns0:echoResponse"/>
</wsdl:message>
?
<wsdl:portType name="EchoPortType">
?
<wsdl:operation name="echo">
<wsdl:input message="axis2:echoRequest" wsaw:Action="urn:echo"/>
<wsdl:output message="axis2:echoResponse" wsaw:Action="urn:echoResponse"/>
</wsdl:operation>
</wsdl:portType>
?
<wsdl:binding name="EchoSOAP11Binding" type="axis2:EchoPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
?
<wsdl:operation name="echo">
<soap:operation soapAction="urn:echo" style="document"/>
?
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
?
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
?
<wsdl:binding name="EchoSOAP12Binding" type="axis2:EchoPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
?
<wsdl:operation name="echo">
<soap12:operation soapAction="urn:echo" style="document"/>
?
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
?
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
?
<wsdl:binding name="EchoHttpBinding" type="axis2:EchoPortType">
<http:binding verb="POST"/>
?
<wsdl:operation name="echo">
<http:operation location="Echo/echo"/>
?
<wsdl:input>
<mime:content type="text/xml" part="echo"/>
</wsdl:input>
?
<wsdl:output>
<mime:content type="text/xml" part="echo"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
?
<wsdl:service name="Echo">
?
<wsdl:port name="EchoSOAP11port_http"
binding="axis2:EchoSOAP11Binding">
<soap:address location="http://localhost:8080/axis2/services/Echo"/>
</wsdl:port>
?
<wsdl:port name="EchoSOAP12port_http"
binding="axis2:EchoSOAP12Binding">
<soap12:address location="http://localhost:8080/axis2/services/Echo"/>
</wsdl:port>
?
<wsdl:port name="EchoHttpport" binding="axis2:EchoHttpBinding">
<http:address location="http://localhost:8080/axis2/services/Echo"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
======================
request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header/>
<soap:Body>
<test:echo>
<!--Optional:-->
<in>?</in>
</test:echo>
</soap:Body>
</soap:Envelope>
response:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Receiver</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Message Receiver not found for
AxisOperation: echo</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<Exception>org.apache.axis2.AxisFault: Message Receiver not
found
for AxisOperation: echo
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:141)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at
org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:256)
at
org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:259)
at
org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:166)
at
org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:85)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:595)</Exception>
</soapenv:Detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]