When you do REST invocation, we do not look at the SOAPAction header or WS-A headers in the server side. So the server side code couldn't dispatch to the proper operation.
But if you change the toEpr to http://localhost:7001/axis2/rest/MyService/MyAction, then it should work. I presume MyAction is the name of the operation. If not put the name of the operation instead of MyAction, in the epr. -- Chinthaka heikki wrote: > Hi, > > I've seen the earlier posts on similar subjects but I have not found my > solution .. > > I have a service that I want to access in REST style. The client code is > > String toEpr = " http://localhost:7001/axis2/rest/MyService"; > Options options = new Options(); > options.setTo(new EndpointReference(toEpr)); > options.setAction("MyAction"); > options.setTransportInProtocol(Constants.TRANSPORT_HTTP); > options.setProperty(Constants.Configuration.ENABLE_REST, > Constants.VALUE_TRUE); > > ServiceClient sender = new ServiceClient(); > sender.engageModule(new QName(Constants.MODULE_ADDRESSING)); > sender.setOptions(options); > > XMLStreamReader reader = document.newXMLStreamReader(); // > document is an XMLBeans binding that already has read its data from an XML > file > StAXOMBuilder builder = new StAXOMBuilder(reader); > OMElement payload= builder.getDocumentElement(); > OMElement result = sender.sendReceive(payload); > > When executing, on the server I get the following exception : > > org.apache.axis2.AxisFault: Operation Not found EPR is > /axis2/services/MyService and WSA Action = null > > It makes no difference whether or not I set the action on the options, > as in > the above client code. It also makes no difference whether or not I set the > addressing module on the sender, as in the above code. > > In services.xml on the server I have the following > > <serviceGroup> > <service name="MyService"> > <messageReceivers> > <messageReceiver mep=" http://www.w3.org/2004/08/wsdl/in-out" > class="com.this.and.that.MyServiceMessageReceiverInOut"/> > </messageReceivers> > <parameter locked="false" name="ServiceClass"> > com.this.and.that.MyServiceSkeleton</parameter> > <operation name="MyRQ" mep="http://www.w3.org/2004/08/wsdl/in-out"> > <actionMapping>MyAction</actionMapping> > </operation> > </service> > </serviceGroup> > > Does anyone have an idea what I'm missing or doing wrong ?? > > thank you > Heikki Doeleman >
signature.asc
Description: OpenPGP digital signature
