> I don't like to live dangerously so I did start with the WSDL first, then wsdl2java,
Ok, terrific! > In trying to solve this, my assumption [I know those are dangerous] was that the xmlns="" was causing it to not identify the element it was looking for correctly. Yes, absolutely correct. If you modify the generated code for the client side proxy, to remove or comment out : [return: System.Xml.Serialization.XmlElementAttribute("return")] And insert [return: System.Xml.Serialization.XmlElementAttribute("return", Namespace="")] Then re-compile and run, what do you get? --- For some reason the XML generated by AXIS is not agreeing with the XML expected by .NET. And therefore one (or both) of them is not agreeing with the WSDL. Let me ask you this: When you generate the .NET client-side proxy (using wsdl.exe) , what input WSDL do you use? The initial static WSDL file? Or, the dynamically generated WSDL from http://whatever/AxisService?wsdl ? Also, As you know it is possible to change the mapping between types and XML elements using AXIS' deploy.wsdd file, to set a different namespace. Are you doing this? In the deploy.wsdd, there should be an <operation> element for each webmethod. This: <operation name="echoString" qname="operNS:echoString" xmlns:operNS="urn:LookupBorrower" returnQName="return" xmlns:retNS="urn:LookupBorrower" returnType="rtns:string" xmlns:rtns="http://www.w3.org/2001/XMLSchema" soapAction="" > ...will give you a xmlns="" on the <output> element. Notice the returnQName="output" attribute in the above, which indicates an element in the default (presumably blank) namespace. In contrast, if you want the <output> element to be placed into the namespace urn:LookupBorrower, then you need this: <operation name="echoString" qname="operNS:echoString" xmlns:operNS="urn:LookupBorrower" returnQName="retNS:return" xmlns:retNS="urn:LookupBorrower" returnType="rtns:string" xmlns:rtns="http://www.w3.org/2001/XMLSchema" soapAction="" > Notice the returnQName is now qualified with a prefix. Since this prefix refers to the same namespace as used in the response element, namely urn:LookupBorrower, the returned xml will be: <echoStringResponse xmlns="urn:LookupBorrower"> <return>Hi there</return> </echoStringResponse> ...which is what you were hoping for, I think. --- Boil it down: the namespace you tell AXIS to use for your return elements, must be the same as the namespace you tell .NET to use for those elements. It can be blank (xmlns=""), or it can be non-blank. It just has to be the same on each side. Starting from WSDL first generally does this. If you tweak the deploy.wsdd, or the in-line code attributes on the .NET side, you can move things around. -D -----Original Message----- From: Richard Wallis [mailto:[EMAIL PROTECTED] Sent: Friday, March 11, 2005 1:14 PM To: axis-user@ws.apache.org Subject: RE: Empty namespace - again Hi Dino, I don't like to live dangerously so I did start with the WSDL first, then wsdl2java, then tested my solution axis - axis, finally used Visual C#.net to pull in a Web reference to my service and let it build everything. The underlying code it built looks very similar to what you attached: /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:LookupBorrower", ResponseNamespace="urn:LookupBorrower", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped) ] [return: System.Xml.Serialization.XmlElementAttribute("return")] public string echoString(string inputString) { object[] results = this.Invoke("echoString", new object[] {inputString}); return ((string)(results[0])); } So all looks fine, but even though the SOAP looks ok when intercepted: <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> <echoStringResponse xmlns="urn:LookupBorrower"> <return xmlns="">Hi there</return> </echoStringResponse> </soapenv:Body> </soapenv:Envelope> The C# always gives a null for the retun value (Actually 'results' is an array of size one with that element = null. In trying to solve this, my assumption [I know those are dangerous] was that the xmlns="" was causing it to not identify the element it was looking for correctly. Richard. > -----Original Message----- > From: Dino Chiesa [mailto:[EMAIL PROTECTED] > Sent: 11 March 2005 17:49 > To: axis-user@ws.apache.org; Anne Thomas Manes > Subject: RE: Empty namespace - again > > > > ....an empty namespace thus: > > > > <soapenv:Body> > > <return xmlns="">Hello World</return> > > </soapenv:Body> > > > > Following many threads on this list it is clear that this is a > problem. > > > > If you are trying to consume an axis service in .net it > appears to be > > a 'show stopper'. > > No. > > xmlns="" is not a problem for .NET. > > With .NET, just as with AXIS, you can specify to the XML serialization > engine the XML namespace to use for requests, responses, and embedded > complextypes. You can specify other things, too, like the xml element > name, or attribute name, or other stuff. > > In general, this is all done for you (by both AXIS and .NET), if you > follow rule #1 and Start With WSDL First (tm). > > If you like to live dangerously, and not Start With WSDL First (tm) , > then you need to modify the generated .NET client-side stubs to > introduce or modify attributes on your methods and types, that agree > with the XML put on the wire by AXIS. > > Here's some code that was generated by the .NET Wsdl.exe tool: > > [SoapDocumentMethodAttribute > ("", > RequestNamespace="urn:ionic.webservices.2005.03.Types", > ResponseNamespace="urn:ionic.webservices.2005.03.Types", > Use=System.Web.Services.Description.SoapBindingUse.Literal, > > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyl > e.Wrapped) > ] > [return: XmlElementAttribute("getComplexTypeReturn")] > public MyComplexType getComplexType(string caller) { > object[] results = this.Invoke("getComplexType", new object[] { > caller}); > return ((MyComplexType)(results[0])); } > > This says, > -Use "" for the SoapAction. > -Use the specified strings for the request and response namespaces, > Respectively. They need not be the same. > -literal encoding > -wrap the response in an element > -the return element will be <getComplexTypeReturn> > > > The generated type on the .NET side looks like > [XmlType(Namespace="urn:ionic.webservices.2005.03.Types")] > public class MyComplexType { > ... > } > > Which says, when serializing or de-serializing this type, the xml > element should be in xmlns="urn:ionic.webservices.2005.03.Types". > > If you want xmlns="", then use [XmlType("")]. This says to .NET, when > serializing or de-serializing, the XML element should have xmlns="". > > ....and the show goes on... > > By the way, the same sort of attribute-based tweaking of the behavior > of the XML serializer is possible on the server side, for .NET > services. > So if you have a Java/AXIS webservice client that needs to consume an > ASMX .NET webservice, you can use these same sorts of attributes to > get > the two sides to agree. > > ------ > > Generally though, if you follow the first law of web services interop, > you don't have to trouble yourself with *any of* these issues. The > tools do it for you, which leaves more time for you to enjoy your > life. > [Come to think of it, I should probably start advising people > to Start > With WSDL First(tm). Hmm, good idea, Maybe I will do that....] > > -Dino > > > > -----Original Message----- > From: Richard Wallis [mailto:[EMAIL PROTECTED] > Sent: Friday, March 11, 2005 12:02 PM > To: axis-user@ws.apache.org; Anne Thomas Manes > Subject: RE: Empty namespace - again > > Hi Anne, > > Thanks for this, but two problems: > 1. My copy of XMLSpy complains "Message part 'parameters' (in Message > echoStringRequest) - parameter intf:echoString: NS prefix does not > refer to this schema!" > > But more importantly, > 2. The problem still persists but nested 1 level down, 'return' still > has xmlns="": > > <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> > <echoStringResponse xmlns="urn:LookupBorrower"> > <return xmlns="">Hello mum</return> > </echoStringResponse> > </soapenv:Body> > </soapenv:Envelope> > > Richard. > > > -----Original Message----- > > From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] > > Sent: 11 March 2005 15:56 > > To: axis-user@ws.apache.org > > Subject: Re: Empty namespace - again > > > > Richard, > > > > This is not a valid doc/literal WSDL document. You need to > define the > > WSDL differently depending on whether you want rpc/encoded, > > rpc/literal, of doc/literal. > > > > Here's how you should define your WSDL if you'd like to create a > > doc/literal service conforming to the "wrapped" > > programming convention (which offers the best interoperability with > > .NET). > > > > <wsdl:definitions xmlns:impl="urn:LookupBorrower" > > xmlns:intf="urn:LookupBorrower" > > xmlns:apachesoap="http://xml.apache.org/xml-soap" > > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" > > targetNamespace="urn:LookupBorrower"> > > <wsdl:types> > > <xsd:schema targetNamepsace="urn:LookupBorrower"> > > <xsd:element name="echoString"> > > <xsd:complexType> > > <xsd:sequence> > > <xsd:element name="inputString" type="xsd:string"/> > > </xsd:sequence> > > </xsd:complexType> > > </xsd:element> > > <xsd:element name="echoResponse"> > > <xsd:complexType> > > <xsd:sequence> > > <xsd:element name="return" type="xsd:string"/> > > </xsd:sequence> > > </xsd:complexType> > > </xsd:element> > > </xsd:schema> > > </wsdl:types> > > <wsdl:message name="echoStringRequest"> > > <wsdl:part name="parameters" element="intf:echoString"/> > > </wsdl:message> > > <wsdl:message name="echoStringResponse"> > > <wsdl:part name="parameters" element="intf:echoResponse"/> > > </wsdl:message> > > <wsdl:portType name="LookupBorrower"> > > <wsdl:operation name="echoString"> > > <wsdl:input message="impl:echoStringRequest"/> > > <wsdl:output message="impl:echoStringResponse"/> > > </wsdl:operation> > > </wsdl:portType> > > <wsdl:binding name="LookupBorrowerSoapBinding" > > type="impl:LookupBorrower"> > > <wsdlsoap:binding style="document" > > transport="http://schemas.xmlsoap.org/soap/http"/> > > <wsdl:operation name="echoString"> > > <wsdl:input> > > <wsdlsoap:body use="literal"/> > > </wsdl:input> > > <wsdl:output> > > <wsdlsoap:body use="literal"/> > > </wsdl:output> > > </wsdl:operation> > > </wsdl:binding> > > <wsdl:service name="LookupBorrowerService"> > > <wsdl:port name="LookupBorrower" > > binding="impl:LookupBorrowerSoapBinding"> > > <wsdlsoap:address > > > > location="http://localhost:8080/axis/services/LookupBorrower"/> > > </wsdl:port> > > </wsdl:service> > > </wsdl:definitions> > > > > > > On Fri, 11 Mar 2005 15:37:34 -0000, Richard Wallis > > <[EMAIL PROTECTED]> wrote: > > > Here is the whole doc. > > > > > > For information I have tested this with all 4 possible > > combinations of > > > document/rpc & literal/encoded and the work fine axis to > axis. The > > > problem is that .net doesn't like xmlns="" or encoded. > > > > > > <wsdl:definitions xmlns:impl="urn:LookupBorrower" > > > xmlns:intf="urn:LookupBorrower" > > > xmlns:apachesoap="http://xml.apache.org/xml-soap" > > > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" > > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" > > > targetNamespace="urn:LookupBorrower"> > > > <wsdl:message name="echoStringRequest"> > > > <wsdl:part name="inputString" type="xsd:string"/> > > > </wsdl:message> > > > <wsdl:message name="echoStringResponse"> > > > <wsdl:part name="return" type="xsd:string"/> > > > </wsdl:message> > > > <wsdl:portType name="LookupBorrower"> > > > <wsdl:operation name="echoString" > > > parameterOrder="inputString"> > > > <wsdl:input > > message="impl:echoStringRequest"/> > > > <wsdl:output > > message="impl:echoStringResponse"/> > > > </wsdl:operation> > > > </wsdl:portType> > > > <wsdl:binding name="LookupBorrowerSoapBinding" > > > type="impl:LookupBorrower"> > > > <wsdlsoap:binding style="document" > > > transport="http://schemas.xmlsoap.org/soap/http"/> > > > <wsdl:operation name="echoString"> > > > <wsdl:input> > > > <wsdlsoap:body use="literal" > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > namespace="urn:LookupBorrower"/> > > > </wsdl:input> > > > <wsdl:output> > > > <wsdlsoap:body use="literal" > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > namespace="urn:LookupBorrower"/> > > > </wsdl:output> > > > </wsdl:operation> > > > </wsdl:binding> > > > <wsdl:service name="LookupBorrowerService"> > > > <wsdl:port name="LookupBorrower" > > > binding="impl:LookupBorrowerSoapBinding"> > > > <wsdlsoap:address > > > location="http://localhost:8080/axis/services/LookupBorrower"/> > > > </wsdl:port> > > > </wsdl:service> > > > </wsdl:definitions> > > > > > > Regards, > > > Richard. > > > > -----Original Message----- > > > > From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] > > > > Sent: 11 March 2005 15:22 > > > > To: axis-user@ws.apache.org > > > > Subject: Re: Empty namespace - again > > > > > > > > Please provide the rest of the WSDL document. > > > > > > > > Can we assume that you have defined the <return> element > > in the WSDL? > > > > > > > > Anne > > > > > > > > > > > > On Fri, 11 Mar 2005 15:00:29 -0000, Richard Wallis > > > > <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > > > > > > This combination in the WSDL used as input to wsdl2java: > > > > > > > > > > <wsdlsoap:binding style="document" ........... > > > > > <wsdlsoap:body use="literal" ......... > > > > > > > > > > Results in an empty namespace thus: > > > > > > > > > > <soapenv:Body> > > > > > <return xmlns="">Hello World</return> > > > > > </soapenv:Body> > > > > > > > > > > Following many threads on this list it is clear that this > > > > is a problem. > > > > > > > > > > If you are trying to consume an axis service in .net it > > > > appears to be > > > > > a 'show stopper'. I have tried use="encoded" but .net > > > > rejects it, and > > > > > also style="rpc" but still get xmlns="". > > > > > > > > > > As yet I have not been able to identify a work around > for this. > > > > > Although there seems to some hints of a bug fix for > this in the > > > > > pipeline, it is still a problem in 1.2RC3. > > > > > > > > > > Questions: > > > > > 1. Is there a work around for this so that I can at > > > > least use > > > > > my axis service in .net? > > > > > > > > > > 2. Is there a fix for this that will appear in > > the next RC? > > > > > > > > > > > > > > > Richard Wallis > > > > > > > > > > > > > > > > > > > > > > > > > > >