473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Null object from valid response - Namespace issue?

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.SoapDocumentMethodAt tribute("urn:enquiry",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]
[return:
System.Xml.Serialization.XmlElementAttribute("Logo nResponse",
Namespace="urn:enquiry")]
public LogonResponse
logon([System.Xml.Serialization.XmlElementAttribute("logo n",
Namespace="urn:enquiry")] LogonRequest logon1) {
object[] results = this.Invoke("logon", new object[] {
logon1});
return ((LogonResponse)(results[0]));
}
// LogonResponse

[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=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(Namespac e="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/">

Nov 23 '05 #1
2 5020
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

"Pa********@gmail.com" wrote:
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.SoapDocumentMethodAt tribute("urn:enquiry",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]
[return:
System.Xml.Serialization.XmlElementAttribute("Logo nResponse",
Namespace="urn:enquiry")]
public LogonResponse
logon([System.Xml.Serialization.XmlElementAttribute("logo n",
Namespace="urn:enquiry")] LogonRequest logon1) {
object[] results = this.Invoke("logon", new object[] {
logon1});
return ((LogonResponse)(results[0]));
}
// LogonResponse

[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=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(Namespac e="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/">

Nov 23 '05 #2
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?

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

102
by: junky_fellow | last post by:
Can 0x0 be a valid virtual address in the address space of an application ? If it is valid, then the location pointed by a NULL pointer is also valid and application should not receive "SIGSEGV"...
99
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
13
by: Jiho Han | last post by:
Here's the issue. You have a class, Class Person { public int id; public string firstname; public string lastname; }
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
7
by: news | last post by:
..Net 2.0 Hi, I'm getting a nullreferenceexception when calling a function from a worker thread: private void CallbackProc(string response, Exception ex) { if (this.InvokeRequired) {...
1
by: Joseph Geretz | last post by:
I have a web service page which uses WSE 2.0 SP3 to return a file attachment on one of its method calls. All web service methods are functioning properly, except for this one method which uses WSE...
4
by: Joseph Geretz | last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with authenticated session information. Given the following implementation for our Logout method, I vastly prefer to simply code...
46
by: lovecreatesbea... | last post by:
Do you prefer malloc or calloc? p = malloc(size); Which of the following two is right to get same storage same as the above call? p = calloc(1, size); p = calloc(size, 1);
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.