all groups > dotnet web services > october 2005 >
You're in the

dotnet web services

group:

Null object from valid response - Namespace issue?


Null object from valid response - Namespace issue? Pathogenix NO[at]SPAM gmail.com
10/25/2005 2:10:56 AM
dotnet web services:
Greetings,

I'm trying to fix a web service client which has been implemented in a
dailywtf worthy manner. I've decided to rip all the old code
out and start again from the proxy generated by wsdl.exe. I've
immediately run up against the same problem that spawned the original,
deeply fascinating code.

I can make a request, and Fiddler shows that the service is returning
a valid response, but the client is returning a null object. Browsing
the newsgroups suggests that this is a namespace issue, but I'm too
much of a humble n00b to know what I'm looking for. Below is my
response and the classes and methods which are involved. Can anyone
offer any hints on where to start bugfixing?

// SOAP response

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<hpi:loginResponse
xmlns:hpi="http://www.hpi.co.uk/hpc"><sessionId><![CDATA[Some Number
Goes Here]]></sessionId></hpi:loginResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


// Logon Method


[System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:enquiry",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return:
System.Xml.Serialization.XmlElementAttribute("LogonResponse",
Namespace="urn:enquiry")]
public LogonResponse
logon([System.Xml.Serialization.XmlElementAttribute("logon",
Namespace="urn:enquiry")] LogonRequest logon1) {
object[] results = this.Invoke("logon", new object[] {
logon1});
return ((LogonResponse)(results[0]));
}


// LogonResponse

[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true,
Namespace="urn:enquiry")]
public partial class LogonResponse {

private SessionType sessionField;

/// <remarks/>
public SessionType Session {
get {
return this.sessionField;
}
set {
this.sessionField = value;
}
}
}


// SessionType

[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:enquiry")]
public partial class SessionType {

private string sessionIdField;

/// <remarks/>
public string SessionId {
get {
return this.sessionIdField;
}
set {
this.sessionIdField = value;
}
}
}


// namespace definitions from WSDL header
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:hpc="http://www.hpi.co.uk/hpc"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:hpi="urn:enquiry"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
name="Enquiry" targetNamespace="urn:enquiry"
xmlns="http://schemas.xmlsoap.org/wsdl/">
RE: Null object from valid response - Namespace issue? Kumar Shetgar
10/25/2005 8:05:01 PM
The problem might be with UNQualified Namespace attribute value.
Make sure the client sets namespace attribute as Qualified.
You can also modify WSDL and add the attribute value.

--Kumar Shetgar

[quoted text, click to view]
Re: Null object from valid response - Namespace issue? Pathogenix NO[at]SPAM gmail.com
10/26/2005 6:53:05 AM
Cheers for the response, but I'm embarassed to say that I have no idea
how to implement your suggestions.

Forgive my ignorance, but in my WSDL I've got the following:

<types>
<xs:schema elementFormDefault="qualified"
targetNamespace="urn:enquiry">
<snip />
</xs:schema>
</types>

Shouldn't that make the attributes qualified by default? If not, how do
I make it so?
AddThis Social Bookmark Button