Jamie Taylor
Jamie Taylor

Reputation: 3530

query an XML web service from ASP.NET

I've added a web service into my project in Visual Studio but I can't seem to work out how to query it.

The web service should return XML code based on the query I send to it.

This is what i'm trying

    Dim proxy As New mywebservice.xmlcall()

    Dim query As String = "Select * FROM table"

    Dim dataset1 As DataSet = proxy.call(query)

I seem to get the error

Value of type 'String' cannot be converted to 'System.Data.DataSet'

I'm new to WCF web services and I can't seem to work this one out

Any ideas?

EDIT

<wsdl:operation name="call">
  <soap:operation soapAction="http://website.org/Ixmlcall/call" style="document" />
  <wsdl:input>
    <soap:body use="literal" />
  </wsdl:input>
  <wsdl:output>
    <soap:body use="literal" />
  </wsdl:output>
</wsdl:operation>

That's what's in the WSDL

I get this error too if i change the code like this

Dim dataset1 As DataSet = proxy.call()

Argument not specified for parameter 'value' of 'Public Function call(value As String) As String'

UPDATE

I have changed a few bits now and it now returns an error

ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00229: input source is empty Error at line 0 ORA-06512: at "SYS.XMLTYPE", line 272 ORA-06512: at "PM1STEP.XML_FUNCTION_CALL", line 30 ORA-06512: at line 1

Any ideas?

Upvotes: 2

Views: 940

Answers (3)

Jamie Taylor
Jamie Taylor

Reputation: 3530

I managed to work this one out.

I needed to pass a string to Web Service which contained XML data like this

<Name>Joe Bloggs</Name><Date>3 May 2011</Date>

Upvotes: 0

Ian Miller
Ian Miller

Reputation: 603

According to http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx:

"A DataSet can read and write data and schema as XML documents."

A String is not an XML document although it probably contains one in your case. I imagine you need to create an XmlDocument from your string and then feed that to your Dataset.

Upvotes: 0

Brian Scott
Brian Scott

Reputation: 9361

You can perform dynamic querying without using SQL. That way you avoid the problems with malicious sql injection.

See the following stackoverflow implementation of this;

https://data.stackexchange.com/stackoverflow/s/143/jon-skeet-comparison

Upvotes: 0

Related Questions