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 Gregory Pierce <me...@gregorypierce.com> on 2003/06/21 07:05:12 UTC

Please help trying to consume .NET WebService

Hi folks. I've been beating my head against the wall for a couple of  
days now trying to get Axis 1.1 (currently using the final release and  
still having the same problem) to access a .NET Webservice. Most of the  
webservices I've tried to access which are either GLUE or SOAP based  
come through without a hitch. However, other 'untyped' web services are  
causing me some trouble.

The service I'm trying to define llists its SOAP request as

POST /PDCWebService/WeatherServices.asmx HTTP/1.1
Host: weather.unisysfsp.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.unisys.com/WebServices/GetWeather"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
     <GetWeather xmlns="http://www.unisys.com/WebServices/">
       <ZipCode>string</ZipCode>
     </GetWeather>
   </soap:Body>
</soap:Envelope>

This WSDL is located at  
http://weather.unisysfsp.com/PDCWebService/WeatherServices.asmx?WSDL

What I have tried doing is the following:

try
{
     Service service = new Service();
     call = (Call) service.createCall();

     call.setTargetEndpointAddress( new  
java.net.URL("http://weather.unisysfsp.com/PDCWebService/ 
WeatherServices.asmx") );
     call.setOperationName(new  
QName("http://www.unisys.com/WebServices/", "GetWeatherText"));
      
call.setSOAPActionURI("http://www.unisys.com/WebServices/ 
GetWeatherText");

     call.addParameter("ZipCode", org.apache.axis.Constants.XSD_STRING,  
javax.xml.rpc.ParameterMode.IN );
     call.setReturnType( org.apache.axis.Constants.XSD_STRING );


     Object ret = call.invoke( new Object[]  {"30038"} );

     System.out.println("Return = " + ret + "'");
}
catch (Exception e)
{
     System.err.println("Exception: " + e.toString());

     e.printStackTrace();
}

What happens is that the WebService is invoked, but without the  
parameter ZipCode passed to it. Also, I'm not sure why I has to  
setSOAPActionURI and couldn't find anything in the documentation that  
would state why I would have to do that. I assumed that all I needed to  
do was specify an endpoint, an operation, and a bunch of parameters,  
then invoke the service and wait for the response.

I appreciate ANY help that could be offered including additional  
whitepapers, tutorials, or other documentation on Axis that might not  
be linked to the Apache Axis website.

Thanks in advance!






RE: Please help trying to consume .NET WebService

Posted by "Marc E." <jo...@cablespeed.com>.
Gregory,
  Did you try running wsdl2java on the wsdl file and looking at axis's
generated code? I've had great success invoking .net services when using
wsdl2java.

Marc

-----Original Message-----
From: Gregory Pierce [mailto:me@gregorypierce.com]
Sent: Saturday, June 21, 2003 1:05 AM
To: axis-user@ws.apache.org
Subject: Please help trying to consume .NET WebService


Hi folks. I've been beating my head against the wall for a couple of
days now trying to get Axis 1.1 (currently using the final release and
still having the same problem) to access a .NET Webservice. Most of the
webservices I've tried to access which are either GLUE or SOAP based
come through without a hitch. However, other 'untyped' web services are
causing me some trouble.

The service I'm trying to define llists its SOAP request as

POST /PDCWebService/WeatherServices.asmx HTTP/1.1
Host: weather.unisysfsp.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.unisys.com/WebServices/GetWeather"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
     <GetWeather xmlns="http://www.unisys.com/WebServices/">
       <ZipCode>string</ZipCode>
     </GetWeather>
   </soap:Body>
</soap:Envelope>

This WSDL is located at
http://weather.unisysfsp.com/PDCWebService/WeatherServices.asmx?WSDL

What I have tried doing is the following:

try
{
     Service service = new Service();
     call = (Call) service.createCall();

     call.setTargetEndpointAddress( new
java.net.URL("http://weather.unisysfsp.com/PDCWebService/
WeatherServices.asmx") );
     call.setOperationName(new
QName("http://www.unisys.com/WebServices/", "GetWeatherText"));

call.setSOAPActionURI("http://www.unisys.com/WebServices/
GetWeatherText");

     call.addParameter("ZipCode", org.apache.axis.Constants.XSD_STRING,
javax.xml.rpc.ParameterMode.IN );
     call.setReturnType( org.apache.axis.Constants.XSD_STRING );


     Object ret = call.invoke( new Object[]  {"30038"} );

     System.out.println("Return = " + ret + "'");
}
catch (Exception e)
{
     System.err.println("Exception: " + e.toString());

     e.printStackTrace();
}

What happens is that the WebService is invoked, but without the
parameter ZipCode passed to it. Also, I'm not sure why I has to
setSOAPActionURI and couldn't find anything in the documentation that
would state why I would have to do that. I assumed that all I needed to
do was specify an endpoint, an operation, and a bunch of parameters,
then invoke the service and wait for the response.

I appreciate ANY help that could be offered including additional
whitepapers, tutorials, or other documentation on Axis that might not
be linked to the Apache Axis website.

Thanks in advance!