wood burning stoves 2.0*
The moose likes Web Services and the fly likes Trying to create a java web service client using axis2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Trying to create a java web service client using axis2" Watch "Trying to create a java web service client using axis2" New topic
Author

Trying to create a java web service client using axis2

Ammu Isac
Greenhorn

Joined: Dec 04, 2009
Posts: 6
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
Marshal

Joined: Mar 22, 2005
Posts: 42291
    
  64
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?


Ping & DNS - my free Android networking tools app
Ammu Isac
Greenhorn

Joined: Dec 04, 2009
Posts: 6
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
Marshal

Joined: Mar 22, 2005
Posts: 42291
    
  64
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.
 
wood burning stoves
 
subject: Trying to create a java web service client using axis2