You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Kanchana Welagedara <ka...@gmail.com> on 2009/10/30 09:59:42 UTC

[Axis2]AxisFault: Received SOAP request with no data

Hi Folks

I'm writing a Dynamic Client to invoke a non axis WS the client is written
with axis2 AXIOM with no stubs generation.This service deals with only
simple types no complex types involve here.WS is about concatenating two
string.The same service works fine with normal stubs generation method.
how do I set the soap envelop/action in OMElement?

Any view,idea are really appreciated to resolve this problem.Client code and
results are pasted bellow.

Thanks
Kanchana
========================================DynamicClient.java=====================================>

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.databinding.utils.BeanUtil;
import org.apache.axis2.engine.DefaultObjectSupplier;

public class DynamicClient {
    private static EndpointReference targetEPR = new EndpointReference(
            "http://localhost:8092/prweb54/PRSOAPServlet");

    /**
     * @param args
     */
    public static void main(String[] args) throws AxisFault {

        Options options = new Options();
        options.setTo(targetEPR);

options.setAction("urn:PegaRULES:SOAP:ERAService:TestWebService#TestWebService");
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setSoapVersionURI("http://schemas.xmlsoap.org/wsdl/soap");
        ServiceClient sender = new ServiceClient();
        sender.setOptions(options);

        OMElement result = sender.sendReceive(getCustomerPayload());
        System.out.println(result);

    }

    public static OMElement getCustomerPayload() {
        OMFactory fac = OMAbstractFactory.getOMFactory();

        OMNamespace omNs = fac.createOMNamespace(
                "urn:testRULES:SOAP:ERAService:TestWebService", "ns");
           OMElement method = fac.createOMElement("TestWebService", omNs);
        OMElement value = fac.createOMElement("TestWebService", omNs);
        value.setText("Testing");
        method.addChild(value);
        return method;
    }
}
=====================================End of
Client==================================


The Clients fails withe following TCP mon out put


==============================TCPMON
Output======================================

Content-Type: text/xml;charset=UTF-8
Content-Length: 448
Date: Fri, 30 Oct 2009 05:47:36 GMT
Connection: close

<?xml version="1.0" ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode><faultstring>Received SOAP request
with no data</faultstring></SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
==============================================================================================

Here is  the TCP mon out put for when i invoke the service with generated
proxies

============================================================================================
<?xml version="1.0" ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns:TestWebServiceResponse
xmlns:ns="urn:PegaRULES:SOAP:ERAService:TestWebService"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<fname xsi:type="xsd:string">TestWebService!!!!!!!!</fname>
</ns:TestWebServiceResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
===========================================================================================