I have a simple class that I am exposing as a Web Service and calling from .NET:
package com.mypackage;
public class Greeting {
public String sayHello(String caller) {
return "Axis says hello to " + caller;
}
}
I use a simple deployment:
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Greeting" provider="java:RPC" use="literal">
<requestFlow><handler type="soapmonitor"/></requestFlow>
<responseFlow><handler type="soapmonitor"/></responseFlow>
<parameter name="allowedMethods" value="sayHello"/>
<parameter name="className" value="com.mypackage.Greeting"/>
</service>
</deployment>
If I call deploy this in Axis1.1RC1 (WSDL below) and call it from a C# program running in VS.NET, I see the following in the Soap Monitor:
Request:
<?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>
<sayHello xmlns="http://localhost:9080/WS1/services/Greeting">
<caller>.NET</caller>
</sayHello>
</soap:Body>
</soap:Envelope>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<sayHelloResponse xmlns="http://localhost:9080/WS1/services/Greeting">
<sayHelloReturn xmlns="">Axis says hello to .NET</sayHelloReturn>
</sayHelloResponse>
</soapenv:Body>
</soapenv:Envelope>
But the .NET Proxy doesn't seem to be able to find the output message and return null as the result of the call
If I deploy this in Axis 1.1RC2 (WSDL below) when I try to add a reference to the service in my VS.NET project, it fails with the message:
Key cannot be null. Parameter name: key
Now I can get around this by providing more info in my deployment:
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Greeting" provider="java:RPC" use="literal">
<requestFlow><handler type="soapmonitor"/></requestFlow>
<responseFlow><handler type="soapmonitor"/></responseFlow>
<operation name="sayHello" qname="ns1:sayHello" returnQName="ns1:sayHelloResult" returnType="xsd:string" xmlns:ns1="http://mypackage.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<parameter qname="ns1:caller" type="xsd:string"/>
</operation>
<parameter name="wsdlTargetNamespace" value="http://mypackage.com/"/>
<parameter name="allowedMethods" value="sayHello"/>
<parameter name="className" value="com.mypackage.Greeting"/>
</service>
</deployment>
Under both RC1 and RC2, the above results in a successful call from .NET. The Response is different from the above response in 2 ways:
<sayHelloResponse xmlns="http://mypackage.com/">
<sayHelloResult>Axis says hello to .NET</sayHelloResult>
</sayHelloResponse>
It uses the specified namespace and there is no longer the xmlns="" attribute in the sayHelloResult tag.
Now the question:
Is this a bug in Axis?
Is this a bug in .NET?
Am I doing things wrong?
Or do I just expect too much?
Any thoughts would be appreciated. Thanks.
Some gory details:
WSDL for the simple deployment under RC1:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:9080/WS1/services/Greeting" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:9080/WS1/services/Greeting" xmlns:intf="http://localhost:9080/WS1/services/Greeting" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><wsdl:types><schema targetNamespace="http://localhost:9080/WS1/services/Greeting" xmlns="http://www.w3.org/2001/XMLSchema"><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><element name="sayHello"><complexType><sequence><element name="caller" type="xsd:string&q! uot;/></sequence></complexType></element><element name="sayHelloResponse"><complexType><sequence><element name="sayHelloReturn" type="xsd:string"/></sequence></complexType></element></schema></wsdl:types>
<wsdl:message name="sayHelloResponse">
<wsdl:part element="intf:sayHelloResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="sayHelloRequest">
<wsdl:part element="intf:sayHello" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Greeting">
<wsdl:operation name="sayHello" parameterOrder="">
<wsdl:input message="intf:sayHelloRequest" name="sayHelloRequest"/>
<wsdl:output message="intf:sayHelloResponse" name="sayHelloResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GreetingSoapBinding" type="intf:Greeting">
<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloRequest">
<wsdlsoap:body namespace="http://localhost:9080/WS1/services/Greeting" use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<wsdlsoap:body namespace="http://localhost:9080/WS1/services/Greeting" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GreetingService">
<wsdl:port binding="intf:GreetingSoapBinding" name="Greeting">
<wsdlsoap:address location="http://localhost:9080/WS1/services/Greeting"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
WSDL for the simple deployment under RC2:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:9080/WS2/services/Greeting" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:9080/WS2/services/Greeting" xmlns:intf="http://localhost:9080/WS2/services/Greeting" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><wsdl:types><schema targetNamespace="" xmlns="http://www.w3.org/2001/XMLSchema"><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><element name="sayHello"><complexType><sequence><element name="caller" type="xsd:string"/></sequence></complexType&! gt;</element><element name="sayHelloResponse"><complexType><sequence><element name="sayHelloReturn" type="xsd:string"/></sequence></complexType></element></schema></wsdl:types>
<wsdl:message name="sayHelloResponse">
<wsdl:part element="sayHelloResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="sayHelloRequest">
<wsdl:part element="sayHello" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Greeting">
<wsdl:operation name="sayHello" parameterOrder="">
<wsdl:input message="intf:sayHelloRequest" name="sayHelloRequest"/>
<wsdl:output message="intf:sayHelloResponse" name="sayHelloResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GreetingSoapBinding" type="intf:Greeting">
<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloRequest">
<wsdlsoap:body namespace="http://localhost:9080/WS2/services/Greeting" use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<wsdlsoap:body namespace="http://localhost:9080/WS2/services/Greeting" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GreetingService">
<wsdl:port binding="intf:GreetingSoapBinding" name="Greeting">
<wsdlsoap:address location="http://localhost:9080/WS2/services/Greeting"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
WSDL for the working deployment under RC2:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://mypackage.com/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://mypackage.com/" xmlns:intf="http://mypackage.com/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><wsdl:types><schema targetNamespace="http://mypackage.com/" xmlns="http://www.w3.org/2001/XMLSchema"><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><element name="sayHello"><complexType><sequence><element name="caller" type="xsd:string"/></sequence></complexType></element><element name="say! HelloResponse"><complexType><sequence><element name="sayHelloResult" type="xsd:string"/></sequence></complexType></element></schema></wsdl:types>
<wsdl:message name="sayHelloResponse">
<wsdl:part element="intf:sayHelloResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="sayHelloRequest">
<wsdl:part element="intf:sayHello" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Greeting">
<wsdl:operation name="sayHello" parameterOrder="">
<wsdl:input message="intf:sayHelloRequest" name="sayHelloRequest"/>
<wsdl:output message="intf:sayHelloResponse" name="sayHelloResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GreetingSoapBinding" type="intf:Greeting">
<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloRequest">
<wsdlsoap:body namespace="http://mypackage.com/" use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<wsdlsoap:body namespace="http://mypackage.com/" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GreetingService">
<wsdl:port binding="intf:GreetingSoapBinding" name="Greeting">
<wsdlsoap:address location="http://localhost:9080/WS2/services/Greeting"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>