Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to create a java web service client using axis2

 
Ammu Isac
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to create a java client for accesing a .NET web service. The below code gives an exception : Exception in thread "main" org.apache.axis2.AxisFault: The input stream for an incoming message is null.

Can anyone please help me to solve this.


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.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
public class NewTest {
public static void main(String args[]) throws Exception {
System.out.println("H");
ServiceClient client = new ServiceClient();
Options opts = new Options();
opts.setTo(new EndpointReference("http://ip/Service.asmx"));
opts.setAction("http://tempuri.org/GetDetails");
client.setOptions(opts);
OMElement res = client.sendReceive(createPayLoad());

}
public static OMElement createPayLoad() {

OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://tempuri.org", "ns1");
OMElement method = fac.createOMElement("GetDetails", omNs);
OMElement value = fac.createOMElement("24018", omNs);
value.setText("client Api");
method.addChild(value);
return method;

}}


Thanks.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the Axis OM API is rather tedious; is there any way you can use the wsdl2java tool to create Java client code off the service's WSDL?
 
Ammu Isac
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

Now i am using wsdl2java tool to create the client code.

My problem is i am not able to find wsdl2java.bat in the bin folder. I am using,

axis2c-bin-1.1.0-win32
JDK 1.4 (i cant use 1.5)

when giving this commend,

WSDL2Java.bat -uri http://localhost:8080/axis2/services/HelloWorldService?wsdl -o client

i am getting the following exception.

WSDL2Java.bat is not recognised as an internal or external command.

Please help to solve this.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to create Java code you had better be using Axis2/Java, not Axis2/C. The current version is 1.5.1, but that requires Java 5. Version 1.4 works with Java 1.4, though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic