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 00:39:13 UTC

new to axis. axis2 transport error

hi,
i am new to webservices and axis2.
have started off with the guides and samples from the axis2 distribution.
my requirement is to write webservice clients (connecting to .net
webservices) and not webservices themselves.
 
i am trying to put together a very simple client to connect to the google
spell checker service. i dont need an user interface like the one in the
samples.
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 from inside idea like -> 
 
C:/j2sdk1.4.2_02\bin\java
-Daxis2.home=C:\Implementations\axis\axis2-std-0.94-bin
-Dfile.encoding=windows-1252 -classpath
"C:\j2sdk1.4.2_02\jre\lib\charsets.jar;C:\j2sdk1.4.2_02\jre\lib\jce.jar;C:\j2
sdk1.4.2_02\jre\lib\jsse.jar;C:\j2sdk1.4.2_02\jre\lib\plugin.jar;C:\j2sdk1.4.
2_02\jre\lib\rt.jar;C:\j2sdk1.4.2_02\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_02\
jre\lib\ext\dnsns.jar;C:\j2sdk1.4.2_02\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.2_
02\jre\lib\ext\localedata.jar;C:\j2sdk1.4.2_02\jre\lib\ext\sunjce_provider.ja
r;C:\Sybase\EAServer\java\classes;C:\Implementations\axis\axis2-std-0.94-bin\
lib\wstx-asl-2.8.1.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\maven-i
test-plugin-1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis2-adb-
0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\annogen-0.1.0.jar;C:\
Implementations\axis\axis2-std-0.94-bin\lib\axis2-codegen-0.94.jar;C:\Impleme
ntations\axis\axis2-std-0.94-bin\lib\commons-codec-1.3.jar;C:\Implementations
\axis\axis2-std-0.94-bin\lib\XmlSchema-SNAPSHOT.jar;C:\Implementations\axis\a
xis2-std-0.94-bin\lib\geronimo-spec-javamail-1.3.1-rc5.jar;C:\Implementations
\axis\axis2-std-0.94-bin\lib\xbean-2.1.0.jar;C:\Implementations\axis\axis2-st
d-0.94-bin\lib\axis2-core-0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin
\lib\xercesImpl-2.7.1.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\stax
-api-1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\geronimo-spec-act
ivation-1.0.2-rc4.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis-wsd
l4j-1.2.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\commons-httpclient
-3.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\backport-util-concurr
ent-2.0_01_pd.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\commons-logg
ing-1.0.4.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\servletapi-2.3.j
ar;C:\Implementations\axis\axis2-std-0.94-bin\lib\ws-policy-SNAPSHOT.jar;C:\I
mplementations\axis\axis2-std-0.94-bin\lib\geronimo-spec-jms-1.1-rc4.jar;C:\I
mplementations\axis\axis2-std-0.94-bin\lib\xml-apis-1.3.02.jar;C:\Implementat
ions\axis\axis2-std-0.94-bin\lib\axis2-doom-0.94.jar;C:\Implementations\axis\
axis2-std-0.94-bin\lib\log4j-1.2.12.jar;C:\Implementations\axis\axis2-std-0.9
4-bin\lib\jaxen-1.1-beta-7.jar;C:\Program
Files\IntelliJ-IDEA-4.0.3\lib\idea_rt.jar" -Didea.launcher.port=7539
"-Didea.launcher.library=C:\Program
Files\IntelliJ-IDEA-4.0.3\bin\breakgen.dll"
com.intellij.rt.execution.application.AppMain sapphire.custom.axis.TestClient
 
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 ? i am quite wretched that i cannot get my first code
to run.
i dont understand why the samples work fine, but my code doesn't. all that i
have done is copy pasted from the samples.
 
shuvro..

Re: new to axis. axis2 transport error

Posted by Saminda Abeyruwan <sa...@opensource.lk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

This is due .NET side's inability to accept chunked streams. In your
client,  set the property,

options.setProperty(org.apache.axis2.context.MessageContextConstants.CHUNKED,org.apache.axis2.Constants.VALUE_FALSE);
 to disable chunking at runtime.

Saminda



Deepal Jayasinghe wrote:
> hmmm ;
> 
> as I can understand the problem is in .Net side , in axis2 by default chunking is enabled ,so in the request header we are not sending content-length so I think at the .Net side they are looking for content-length (not 100% sure)
> 
> any war if you can pls run through the TCP monitor and see what is going on , else send us the request and response that u got using TCP monitor, and other solution is turn off the chunking and send again.
> 
> Thanks,
>  Deepal
> ................................................................
> ~Future is Open~
> 
>   ----- Original Message ----- 
>   From: Mukherjee, Shuvro 
>   To: axis-user@ws.apache.org 
>   Sent: Thursday, January 26, 2006 5:39 AM
>   Subject: new to axis. axis2 transport error
> 
> 
>   hi,
>   i am new to webservices and axis2.
>   have started off with the guides and samples from the axis2 distribution.
>   my requirement is to write webservice clients (connecting to .net webservices) and not webservices themselves.
> 
>   i am trying to put together a very simple client to connect to the google spell checker service. i dont need an user interface like the one in the samples.
>   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().createXMLStreamWriter(writer));
>               writer.flush();
> 
>               System.out.println(writer.toString());
> 
>           }
> 
>           catch (Exception e) {
>               e.printStackTrace();
>           }
>   -------------------------------------------------------------------------------------
> 
>   when i run it from inside idea like -> 
> 
>   C:/j2sdk1.4.2_02\bin\java -Daxis2.home=C:\Implementations\axis\axis2-std-0.94-bin -Dfile.encoding=windows-1252 -classpath "C:\j2sdk1.4.2_02\jre\lib\charsets.jar;C:\j2sdk1.4.2_02\jre\lib\jce.jar;C:\j2sdk1.4.2_02\jre\lib\jsse.jar;C:\j2sdk1.4.2_02\jre\lib\plugin.jar;C:\j2sdk1.4.2_02\jre\lib\rt.jar;C:\j2sdk1.4.2_02\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_02\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.2_02\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.2_02\jre\lib\ext\localedata.jar;C:\j2sdk1.4.2_02\jre\lib\ext\sunjce_provider.jar;C:\Sybase\EAServer\java\classes;C:\Implementations\axis\axis2-std-0.94-bin\lib\wstx-asl-2.8.1.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\maven-itest-plugin-1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis2-adb-0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\annogen-0.1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis2-codegen-0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\commons-codec-1.3.jar;C:\Implementations\axis\axis2-std-0
.94-bin\lib\XmlSchema-SNAPSHOT.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\geronimo-spec-javamail-1.3.1-rc5.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\xbean-2.1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis2-core-0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\xercesImpl-2.7.1.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\stax-api-1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\geronimo-spec-activation-1.0.2-rc4.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis-wsdl4j-1.2.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\commons-httpclient-3.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\backport-util-concurrent-2.0_01_pd.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\commons-logging-1.0.4.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\servletapi-2.3.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\ws-policy-SNAPSHOT.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\geronimo-spec-jms-1.1-rc4.jar;C:\Impleme
ntations\axis\axis2-std-0.94-bin\lib\xml-apis-1.3.02.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis2-doom-0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\log4j-1.2.12.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\jaxen-1.1-beta-7.jar;C:\Program Files\IntelliJ-IDEA-4.0.3\lib\idea_rt.jar" -Didea.launcher.port=7539 "-Didea.launcher.library=C:\Program Files\IntelliJ-IDEA-4.0.3\bin\breakgen.dll" com.intellij.rt.execution.application.AppMain sapphire.custom.axis.TestClient
> 
>   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(CommonsHTTPTransportSender.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(OutInAxisOperation.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 ? i am quite wretched that i cannot get my first code to run.
>   i dont understand why the samples work fine, but my code doesn't. all that i have done is copy pasted from the samples.
> 
>   shuvro..

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD3dL9YmklbLuW6wYRAjUfAJ4qEDX/YVI7enhEo/fP+zjC/Q2GEACfXdX3
8pr+3gjb8Xtc+OxkF2nQXzo=
=hXf6
-----END PGP SIGNATURE-----

Re: new to axis. axis2 transport error

Posted by Deepal Jayasinghe <de...@opensource.lk>.
hmmm ;

as I can understand the problem is in .Net side , in axis2 by default chunking is enabled ,so in the request header we are not sending content-length so I think at the .Net side they are looking for content-length (not 100% sure)

any war if you can pls run through the TCP monitor and see what is going on , else send us the request and response that u got using TCP monitor, and other solution is turn off the chunking and send again.

Thanks,
 Deepal
................................................................
~Future is Open~

  ----- Original Message ----- 
  From: Mukherjee, Shuvro 
  To: axis-user@ws.apache.org 
  Sent: Thursday, January 26, 2006 5:39 AM
  Subject: new to axis. axis2 transport error


  hi,
  i am new to webservices and axis2.
  have started off with the guides and samples from the axis2 distribution.
  my requirement is to write webservice clients (connecting to .net webservices) and not webservices themselves.

  i am trying to put together a very simple client to connect to the google spell checker service. i dont need an user interface like the one in the samples.
  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().createXMLStreamWriter(writer));
              writer.flush();

              System.out.println(writer.toString());

          }

          catch (Exception e) {
              e.printStackTrace();
          }
  -------------------------------------------------------------------------------------

  when i run it from inside idea like -> 

  C:/j2sdk1.4.2_02\bin\java -Daxis2.home=C:\Implementations\axis\axis2-std-0.94-bin -Dfile.encoding=windows-1252 -classpath "C:\j2sdk1.4.2_02\jre\lib\charsets.jar;C:\j2sdk1.4.2_02\jre\lib\jce.jar;C:\j2sdk1.4.2_02\jre\lib\jsse.jar;C:\j2sdk1.4.2_02\jre\lib\plugin.jar;C:\j2sdk1.4.2_02\jre\lib\rt.jar;C:\j2sdk1.4.2_02\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_02\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.2_02\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.2_02\jre\lib\ext\localedata.jar;C:\j2sdk1.4.2_02\jre\lib\ext\sunjce_provider.jar;C:\Sybase\EAServer\java\classes;C:\Implementations\axis\axis2-std-0.94-bin\lib\wstx-asl-2.8.1.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\maven-itest-plugin-1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis2-adb-0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\annogen-0.1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis2-codegen-0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\commons-codec-1.3.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\XmlSchema-SNAPSHOT.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\geronimo-spec-javamail-1.3.1-rc5.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\xbean-2.1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis2-core-0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\xercesImpl-2.7.1.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\stax-api-1.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\geronimo-spec-activation-1.0.2-rc4.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis-wsdl4j-1.2.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\commons-httpclient-3.0.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\backport-util-concurrent-2.0_01_pd.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\commons-logging-1.0.4.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\servletapi-2.3.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\ws-policy-SNAPSHOT.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\geronimo-spec-jms-1.1-rc4.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\xml-apis-1.3.02.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\axis2-doom-0.94.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\log4j-1.2.12.jar;C:\Implementations\axis\axis2-std-0.94-bin\lib\jaxen-1.1-beta-7.jar;C:\Program Files\IntelliJ-IDEA-4.0.3\lib\idea_rt.jar" -Didea.launcher.port=7539 "-Didea.launcher.library=C:\Program Files\IntelliJ-IDEA-4.0.3\bin\breakgen.dll" com.intellij.rt.execution.application.AppMain sapphire.custom.axis.TestClient

  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(CommonsHTTPTransportSender.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(OutInAxisOperation.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 ? i am quite wretched that i cannot get my first code to run.
  i dont understand why the samples work fine, but my code doesn't. all that i have done is copy pasted from the samples.

  shuvro..