Using SOAP XML files

S

shaselsc

I'm new to SOAP and Web Services in general. I've been given the task
of implementing someone else's web services in an ASP.NET 2.0 project.
What I've been given are two .xml files and several .xsd files. They
are used to query information from their database. The queries are
sent in SOAP format and returned in the same as far as I know. I'm
quite confused on where to start to learn how to call these queries.
Should I be learning more about XML, SOAP, or web services to find out
how to send these queries?

Thanks in advance.
 
S

shaselsc

Here is an example of what is in one of the xml files. I edited some
of the file in case it left their web services open to anyone

<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Generated by the Oracle JDeveloper 10g Web Services WSDL
Generator
-->
- <!-- Date Created: Tue Jun 21 15:14:37 EDT 2005
-->
- <definitions name="OPSQueryWebService" targetNamespace="url/
filename.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://
schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="url/filename.wsdl"
xmlns:ns1="url/filename.xsd">
- <types>
<schema targetNamespace="url/filename.xsd" xmlns="http://www.w3.org/
2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/
encoding/" />
</types>
- <message name="processquery0Request">
<part name="xquery" element="xsd:any" />
</message>
- <message name="processquery0Response">
<part name="return" element="xsd:any" />
</message>
- <portType name="OPSQueryWebServicePortType">
- <operation name="processquery">
<input name="processquery0Request"
message="tns:processquery0Request" />
<output name="processquery0Response"
message="tns:processquery0Response" />
</operation>
</portType>
- <binding name="OPSQueryWebServiceBinding"
type="tns:OPSQueryWebServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/
http" />
- <operation name="processquery">
<soap:eek:peration soapAction="" style="rpc" />
- <input name="processquery0Request">
<soap:body use="literal" namespace="OPSQueryWebService" />
</input>
- <output name="processquery0Response">
<soap:body use="literal" namespace="OPSQueryWebService" />
</output>
</operation>
</binding>
- <service name="OPSQueryWebService">
- <port name="OPSQueryWebServicePort"
binding="tns:OPSQueryWebServiceBinding">
<soap:address location="Edited for security purposes" />
</port>
</service>
</definitions>
 
J

John Saunders [MVP]

I'm new to SOAP and Web Services in general. I've been given the task
of implementing someone else's web services in an ASP.NET 2.0 project.
What I've been given are two .xml files and several .xsd files. They
are used to query information from their database. The queries are
sent in SOAP format and returned in the same as far as I know. I'm
quite confused on where to start to learn how to call these queries.
Should I be learning more about XML, SOAP, or web services to find out
how to send these queries?

All of the above.

Web Services uses SOAP, which is an XML-based language.

Are you being asked to create the service, or simply to consume it? Did you
receive a .wsdl file as well? It's what describes the web service.
 
S

shaselsc

I did not receive any .wsdl files. I'm assuming I'm only here to
consume it since they created all the web services on their end. I'm
just not sure how I consume something like this.
 
J

John Saunders [MVP]

Here is an example of what is in one of the xml files. I edited some
of the file in case it left their web services open to anyone

<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Generated by the Oracle JDeveloper 10g Web Services WSDL
Generator
-->
- <!-- Date Created: Tue Jun 21 15:14:37 EDT 2005
-->
- <definitions name="OPSQueryWebService" targetNamespace="url/
filename.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://
schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="url/filename.wsdl"
xmlns:ns1="url/filename.xsd">
- <types>
<schema targetNamespace="url/filename.xsd" xmlns="http://www.w3.org/
2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/
encoding/" />
</types>
- <message name="processquery0Request">
<part name="xquery" element="xsd:any" />
</message>
- <message name="processquery0Response">
<part name="return" element="xsd:any" />
</message>
- <portType name="OPSQueryWebServicePortType">
- <operation name="processquery">
<input name="processquery0Request"
message="tns:processquery0Request" />
<output name="processquery0Response"
message="tns:processquery0Response" />
</operation>
</portType>
- <binding name="OPSQueryWebServiceBinding"
type="tns:OPSQueryWebServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/
http" />
- <operation name="processquery">
<soap:eek:peration soapAction="" style="rpc" />
- <input name="processquery0Request">
<soap:body use="literal" namespace="OPSQueryWebService" />
</input>
- <output name="processquery0Response">
<soap:body use="literal" namespace="OPSQueryWebService" />
</output>
</operation>
</binding>
- <service name="OPSQueryWebService">
- <port name="OPSQueryWebServicePort"
binding="tns:OPSQueryWebServiceBinding">
<soap:address location="Edited for security purposes" />
</port>
</service>
</definitions>

Good. That's a WSDL file - it's the standard format file for defining how to
use a web service.

You use a WSDL file by creating the project that will consume the service,
then using Add Web Reference. Specify the path to the WSDL file (I know they
talk about URLs, but you can specify the path or browse to it). This will
create a set of proxy classes that you can use in your application to
reference the service.
 
J

John Saunders [MVP]

Should I do the same for the .xsd files? They contain various xsd
schemas.

No the WSDL file is what is consumed.

I have to say that when I tried consuming this file, it didn't work. It was
only a quick try, so maybe if I had more time, I could get it to work
(probably won't be today).

I'm concerned about how this WSDL is written. I think the <part
element="xsd:any"/> is incorrect. "element' is meant to be the name of an
element, and xsd:any is a type name.
 
S

shaselsc

I actually tried adding this as a reference and it didn't work. I
tried Add Web Reference and then typed in the path and clicked once on
the file, but the "Add Reference" button was still greyed out, not
allowing me to get access to the file. Is there something I'm not
doing?

Thanks for all the help so far John.
 
J

John Saunders [MVP]

I actually tried adding this as a reference and it didn't work. I
tried Add Web Reference and then typed in the path and clicked once on
the file, but the "Add Reference" button was still greyed out, not
allowing me to get access to the file. Is there something I'm not
doing?

Yes, but I don't know what that would be! ;-)

Make sure you've entered the full path to the file. Also, if that doesn't
work, try opening the file with Notepad's File->Open command, pasting in the
same file path. Finally, look for any other user interface elements you need
to fill in. For instance, are there other text boxes that need you to input
something valid?

Finally, which version of Visual Studio are you using, which language, etc.
 
S

shaselsc

I found out how I was supposed to handle these services. It turns out
that the services are going to be handled elsewhere and I'm just
supposed to manually create an xml file and send it in a specific
format to their server. At least that's how the previous programmers
were handling it. I'm not sure if this is the best way to handle it or
not, but it seems the web services are all on their end and they were
just giving us the way to format the xml file.

To answer your questions, I am using Visual Studio 2005, C#, and
ASP.NET 2.0.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top