a differnt way to consuming web services?

J

Jo

hi there:

Is there any different way to consume Web services besides using "Add a
web reference" or creating a proxy with wsdl.exe?

I need to pass a username and password to a particular web service and
I would love some guidance

Thanks in advance for your help


jo
 
J

Josh Twist

You could just use HttpWebRequest and manually build the request stream
and headers (web services use HTTP just like web pages) - but wsdl.exe
usually makes this job a lot easier!

Have you tried using Add Web Reference / wsdl.exe - have you tried this
and it doesn't work? How do you need to pass the credentials?

Josh
http://www.thejoyofcode.com/
 
J

Jo

hi josh: thansk for answering.
I have tryed wsdl.exe and add web reference and i get the error:

- the HTML document does not contain Web Service discovery information

I have no idea how to pass the credentials.

I have tryed and succesfully consumend web services from within my
organization and outside but i never came across this :(

I need to pass tree parameters when connecting: username, password, and
some sort of sequence number

Thanks in advance


Jo
 
J

Josh Twist

You need to point add web reference to a valid WSDL file (an xml
document that describes the web service). It sounds like you've pointed
it at an HTML page.

The fact it's a java web service shouldn't make too much difference -
the whole point of web services is that they're interoperable.

Have you asked the guys who operate the service for the location of
their WSDL. If it doesn't have a WSDL then it's not really a web
service.

Let me know what happens next.

Josh
http://www.thejoyofcode.com.
 
J

Jo

hi:

yes i though the same, they have a web service what s more in their
documentation you can read the wsdl fille. in the file you can see
where the document is, i went there and tryed the wsdl.exe in something
similar to this http://host.com/some_folder/file.wsdl
and i still get the same error

I though that maybe in java the wsdl was put togheter in a different
way?
what are yr thoughts?
 
J

Josh Twist

Nope - wsdl is an industry standard, not an MS thing.

What does the .wsdl file look like inside - does it look anything like
this (WSDL from simple HelloWorld service)?

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://tempuri.org/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://tempuri.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/">
<s:element name="HelloWorld">
<s:complexType />
</s:element>
<s:element name="HelloWorldResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="HelloWorldResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="HelloWorldSoapIn">
<wsdl:part name="parameters" element="tns:HelloWorld" />
</wsdl:message>
<wsdl:message name="HelloWorldSoapOut">
<wsdl:part name="parameters" element="tns:HelloWorldResponse" />
</wsdl:message>
<wsdl:portType name="WebServiceSoap">
<wsdl:eek:peration name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn" />
<wsdl:eek:utput message="tns:HelloWorldSoapOut" />
</wsdl:eek:peration>
</wsdl:portType>
<wsdl:binding name="WebServiceSoap" type="tns:WebServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:eek:peration name="HelloWorld">
<soap:eek:peration soapAction="http://tempuri.org/HelloWorld"
style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
</wsdl:binding>
<wsdl:binding name="WebServiceSoap12" type="tns:WebServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:eek:peration name="HelloWorld">
<soap12:eek:peration soapAction="http://tempuri.org/HelloWorld"
style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap12:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
</wsdl:binding>
<wsdl:service name="WebService">
<wsdl:port name="WebServiceSoap" binding="tns:WebServiceSoap">
<soap:address
location="http://localhost:2910/AspNet/WebService.asmx" />
</wsdl:port>
<wsdl:port name="WebServiceSoap12" binding="tns:WebServiceSoap12">
<soap12:address
location="http://localhost:2910/AspNet/WebService.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
 
J

Jo

Yes. it loks similar to that, a bit shorter,

there is some interesting elements:
.....
....
<wsdl:message name="message_Name">
<wsdl:part name="User" type="xsd:string />
....
<wsdl:portType name="port...">
<wsdl:eek:peration name="operation_namel" parameterOrder="User ....">
.....

The part where it says user, after that there is other parametrs i
should be passing so I guess thats where i have to add them but i have
no idea how
 
J

Josh Twist

oops - hit enter too soon.

You shouldn't have to add anything to the WSDL. It describes the
interface of the web service you're using so it's up to the operator of
the web service to provide an accurate WSDL. Which, from what you've
said, it sounds like they have done.

As I asked earlier - are you sure you pointed wsdl.exe at that
document? Otherwise we probably can't help much more without seeing the
WSDL itself. Sorry.

Josh
http://www.thejoyofcode.com/
 
J

Jo

hi josh;

yes, i pointed wsdl.exe to the http://..../file.wsdl :(
and i get the error mentioned above,

the html document does not contain web service discovery information

I ll ask to see if i can put the wsdl doc here


Thanks

Jo
 
J

Jo

ok, I m affraid i cnat put the wsdl file here, :(
But I asked and they said that if i want to create a proxy class i have
to generate it from this wsdl file that is in their doc.

SO do you know how to do that?

Should i create a web service myself and use that file as a wsdl l file
compile and put it somewhere so i can use it to create my proxy??

Any ideas, welcome

Jo
 
J

Jo

HI josh:

tryed that but it doesnt work, It gives me several different
formatting errors, this is their fault
If at the end I find out a technical solution I ll post it here.
Thanks for your help


Jo
 

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,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top