Home All Groups Group Topic Archive Search About

Problem calling XML (non-SOAP) web service with C#

Author
21 Mar 2007 3:11 PM
jumpinjavabean
I am trying to call an XML (non-SOAP) web service with C#.
I was provided with a request schema by our web services team, and I
generated a CLR class for it using XSD.exe.
When I instantiate this schema class and try to set a property on it,
however, I get the following error:

  Object reference not set to an instance of an object.

This is essentially the code that's causing the error:

MyRequestSchema request = new MyRequestSchema();
MyRequestSchema.FirstName = "Jonathan";

Any idea what I'm doing wrong?

Thanks,
Jonathan

Author
21 Mar 2007 3:43 PM
Mubashir Khan
my question ... does that webservice follow any standard protocol other than
soap.
secondly ... i guess you may be writing your own http reponse sink and using
xml parser and reflection to create objects out of that ....
if you could provide us the wsdl for the web service ....


Show quote
"jumpinjavabean" <jumpinjavab***@hotmail.com> wrote in message
news:1174489913.621437.253510@n59g2000hsh.googlegroups.com...
>I am trying to call an XML (non-SOAP) web service with C#.
> I was provided with a request schema by our web services team, and I
> generated a CLR class for it using XSD.exe.
> When I instantiate this schema class and try to set a property on it,
> however, I get the following error:
>
>  Object reference not set to an instance of an object.
>
> This is essentially the code that's causing the error:
>
> MyRequestSchema request = new MyRequestSchema();
> MyRequestSchema.FirstName = "Jonathan";
>
> Any idea what I'm doing wrong?
>
> Thanks,
> Jonathan
>
Author
21 Mar 2007 5:54 PM
jumpinjavabean
Show quote
On Mar 21, 11:43 am, "Mubashir Khan" <m***@yahoo.com> wrote:
> my question ... does that webservice follow any standard protocol other than
> soap.
> secondly ... i guess you may be writing your own http reponse sink and using
> xml parser and reflection to create objects out of that ....
> if you could provide us the wsdl for the web service ....
>
> "jumpinjavabean" <jumpinjavab***@hotmail.com> wrote in message
>
> news:1174489913.621437.253510@n59g2000hsh.googlegroups.com...
>
>
>
> >I am trying to call an XML (non-SOAP) web service with C#.
> > I was provided with a request schema by our web services team, and I
> > generated a CLR class for it using XSD.exe.
> > When I instantiate this schema class and try to set a property on it,
> > however, I get the following error:
>
> >  Object reference not set to an instance of an object.
>
> > This is essentially the code that's causing the error:
>
> > MyRequestSchema request = new MyRequestSchema();
> > MyRequestSchema.FirstName = "Jonathan";
>
> > Any idea what I'm doing wrong?
>
> > Thanks,
> > Jonathan- Hide quoted text -
>
> - Show quoted text -

Thanks for responding Mubashir; I just figured out the problem :)
I made the foolish mistake of renaming the proxy class that was
generated, and I forgot that I had renamed it.
Once I restored the class name, the exception stopped happening, and
everything is working fine.

AddThis Social Bookmark Button