For some reason, the parameters I send from an Axis' client does not reach the .Net Service (the Service behaves as if the value of the params is zero). this is a simple Service that returns the Celsius value of a Fahrenheit input. Do you see anything wrong with my Java Client file. I am using Axis-Beta1 Here is Details: ========= I set up an Axis client to access a simple Web Service. This client can access successfully the Web service Tomcat (localhost:8080). I created a very similar Service on VS.Net ( and this works fine with its own .Net client). In other words, each of Axis and .Net work fine when both the Client and Service are on the same side. When my Axis client invokes the .Net Service, I can see in the SOAP header that the parameters are sent properly, but for some reason, the reurn value is wrong (it indicates that the input parametrs never reach the Service method (the return value of -17.77777 indicates that the input to the Service method is always zero.). In other words, there is a miscommunication between the client's parametes and the Service invocation. I am attaching here a SOAP trace, source files for client and Service, and the wsdl for the Service. Please respond promptly. Thanks Soap request ------------ POST /TempConvert3/Service1.asmx HTTP/1.0 Content-Length: 487 Host: localhost Content-Type: text/xml; charset=utf-8 SOAPAction: "http://Walkthrough/XmlWebServices/ConvertTemperature" <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope SOAP- ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP- ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP- ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ConvertTemperature> <op1 xsi:type="xsd:double">32.05</op1> </ConvertTemperature> </SOAP-ENV:Body> </SOAP-ENV:Envelope> SOAP Respsonse -------------- HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Fri, 26 Apr 2002 04:51:18 GMT Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Content-Length: 418 <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body><ConvertTemperatureResponse xmlns="http://Walkthrough/XmlWebServices/"> <ConvertTemperatureResult>- 17.777777777777779</ConvertTemperatureResult></ConvertTemperatureResponse> </soap:Body></soap:Envelope> Client source ------------ package samples.userguide.example7 ; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; import org.apache.axis.utils.Options; import javax.xml.rpc.ParameterMode; public class MSTempConvClient { public static void main(String [] args) throws Exception { Options options = new Options(args); String endpoint = "http://localhost:" + options.getPort() + "/TempConvert3/Service1.asmx"; args = options.getRemainingArgs(); if (args == null || args.length != 2) { System.err.println("Usage: TempConvClient <conv> arg1"); return; } String method = args[0]; if (!(method.equals("ConvertTemperature"))) { System.err.println("Usage: CalcClient <conv> arg1 "); return; } Double d1 = new Double(args[1]); Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName( method ); call.addParameter( "op1", XMLType.XSD_DOUBLE, ParameterMode.PARAM_MODE_IN ); //call.addParameter( "op2", XMLType.XSD_INT, ParameterMode.PARAM_MODE_IN ); call.setReturnType( XMLType.XSD_DOUBLE ); call.setUseSOAPAction(true); call.setSOAPActionURI ("http://Walkthrough/XmlWebServices/ConvertTemperature"); System.out.println("d1= "+d1); Double ret = (Double)(call.invoke( new Object[] {d1} ) ); System.out.println("Got result : " + ret); } } Source for Service ( C#) ------------------------ using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Web; using System.Web.Services; namespace TempConvert3 { /// <summary> /// Summary description for Service1. /// </summary> [WebService(Namespace="http://Walkthrough/XmlWebServices/", Description="A temperature Conversion Service.")] public class Service1 : System.Web.Services.WebService { [WebMethod(Description="This method converts a temperature in " + "degrees Fahrenheit to a temperature in degrees Celsius.")] public double ConvertTemperature(double dFahrenheit) { return ((dFahrenheit - 32) * 5) / 9; } public Service1() { //CODEGEN: This call is required by the ASP.NET Web Services Designer InitializeComponent(); } #region Component Designer generated code //Required by the Web Services Designer private IContainer components = null; /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if(disposing && components != null) { components.Dispose(); } base.Dispose(disposing); } #endregion // WEB SERVICE EXAMPLE // The HelloWorld() example service returns the string Hello World // To build, uncomment the following lines then save and build the project // To test this web service, press F5 // [WebMethod] // public string HelloWorld() // { // return "Hello World"; // } } } Service wsdl ------------- <?xml version="1.0" encoding="utf-8"?> <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://Walkthrough/XmlWebServices/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://Walkthrough/XmlWebServices/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <s:schema elementFormDefault="qualified" targetNamespace="http://Walkthrough/XmlWebServices/"> <s:element name="ConvertTemperature"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="dFahrenheit" type="s:double" /> </s:sequence> </s:complexType> </s:element> <s:element name="ConvertTemperatureResponse"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="ConvertTemperatureResult" type="s:double" /> </s:sequence> </s:complexType> </s:element> <s:element name="double" type="s:double" /> </s:schema> </types> <message name="ConvertTemperatureSoapIn"> <part name="parameters" element="s0:ConvertTemperature" /> </message> <message name="ConvertTemperatureSoapOut"> <part name="parameters" element="s0:ConvertTemperatureResponse" /> </message> <message name="ConvertTemperatureHttpGetIn"> <part name="dFahrenheit" type="s:string" /> </message> <message name="ConvertTemperatureHttpGetOut"> <part name="Body" element="s0:double" /> </message> <message name="ConvertTemperatureHttpPostIn"> <part name="dFahrenheit" type="s:string" /> </message> <message name="ConvertTemperatureHttpPostOut"> <part name="Body" element="s0:double" /> </message> <portType name="Service1Soap"> <operation name="ConvertTemperature"> <documentation>This method converts a temperature in degrees Fahrenheit to a temperature in degrees Celsius.</documentation> <input message="s0:ConvertTemperatureSoapIn" /> <output message="s0:ConvertTemperatureSoapOut" /> </operation> </portType> <portType name="Service1HttpGet"> <operation name="ConvertTemperature"> <documentation>This method converts a temperature in degrees Fahrenheit to a temperature in degrees Celsius.</documentation> <input message="s0:ConvertTemperatureHttpGetIn" /> <output message="s0:ConvertTemperatureHttpGetOut" /> </operation> </portType> <portType name="Service1HttpPost"> <operation name="ConvertTemperature"> <documentation>This method converts a temperature in degrees Fahrenheit to a temperature in degrees Celsius.</documentation> <input message="s0:ConvertTemperatureHttpPostIn" /> <output message="s0:ConvertTemperatureHttpPostOut" /> </operation> </portType> <binding name="Service1Soap" type="s0:Service1Soap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="ConvertTemperature"> <soap:operation soapAction="http://Walkthrough/XmlWebServices/ConvertTemperature" style="document" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <binding name="Service1HttpGet" type="s0:Service1HttpGet"> <http:binding verb="GET" /> <operation name="ConvertTemperature"> <http:operation location="/ConvertTemperature" /> <input> <http:urlEncoded /> </input> <output> <mime:mimeXml part="Body" /> </output> </operation> </binding> <binding name="Service1HttpPost" type="s0:Service1HttpPost"> <http:binding verb="POST" /> <operation name="ConvertTemperature"> <http:operation location="/ConvertTemperature" /> <input> <mime:content type="application/x-www-form-urlencoded" /> </input> <output> <mime:mimeXml part="Body" /> </output> </operation> </binding> <service name="Service1"> <documentation>A temperature Conversion Service.</documentation> <port name="Service1Soap" binding="s0:Service1Soap"> <soap:address location="http://localhost/TempConvert3/Service1.asmx" /> </port> <port name="Service1HttpGet" binding="s0:Service1HttpGet"> <http:address location="http://localhost/TempConvert3/Service1.asmx" /> </port> <port name="Service1HttpPost" binding="s0:Service1HttpPost"> <http:address location="http://localhost/TempConvert3/Service1.asmx" /> </port> </service> </definitions> |
- RE: Help Help Help - Axis client to .Net Service ... Adel Habib
- RE: Help Help Help - Axis client to .Net Ser... Vidyanand Murunikkara