You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Mukherjee, Shuvro" <sh...@labvantage.com> on 2006/01/26 16:18:34 UTC

axis2 transport error

hi,
i am new to webservices and axis2.

i am trying to put together a very simple client to connect to the google
spell checker service.
i have written something like the following..
-----------------------------------------------------------------------------
----
private void testEchoBlocking(String word){
        try {
            org.apache.axis2.addressing.EndpointReference targetEPR = new
org.apache.axis2.addressing.EndpointReference(new java.net.URL(protocol,
googleEndPoint, googleServiceName).toString());
            org.apache.axis2.om.OMElement payload = getElement(word);
            org.apache.axis2.client.Options options = new
org.apache.axis2.client.Options();
            options.setTo(targetEPR);
 
options.setTransportInProtocol(org.apache.axis2.Constants.TRANSPORT_HTTP);
 
            //Blocking invocation
            org.apache.axis2.client.ServiceClient sender = new
org.apache.axis2.client.ServiceClient();
            sender.setOptions(options);
            org.apache.axis2.om.OMElement result =
sender.sendReceive(payload);
 
            java.io.StringWriter writer = new java.io.StringWriter();
 
result.serialize(javax.xml.stream.XMLOutputFactory.newInstance().createXMLStr
eamWriter(writer));
            writer.flush();
 
            System.out.println(writer.toString());
 
        }
 
        catch (Exception e) {
            e.printStackTrace();
        }
-----------------------------------------------------------------------------
--------
 
 when i run it i get an error like ->
 
- Deploying module : addressing
org.apache.axis2.AxisFault: Axis2 transport error : Length Required; nested
exception is: 
 org.apache.axis2.AxisFault: Axis2 transport error : Length Required; nested
exception is: 
 org.apache.axis2.AxisFault: Axis2 transport error : Length Required; nested
exception is: 
 org.apache.axis2.AxisFault: Axis2 transport error : Length Required
 at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTP
TransportSender.java:245)
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:449)
 at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation
.java:317)
 at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperat
ion.java:267)
 at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:393)
 at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:326)
 at sapphire.custom.axis.TestClient.testEchoBlocking(TestClient.java:112)
 at sapphire.custom.axis.TestClient.main(TestClient.java:31)
 
what am i doing wrong ? 
shuvro..