a differnt way to consuming web services?

Discussion in 'ASP .Net Web Services' started by Jo, Apr 26, 2006.

  1. Jo

    Jo Guest

    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
     
    Jo, Apr 26, 2006
    #1
    1. Advertising

  2. Jo

    Jo Guest

    I know the web service is coded in java
    Would this complicate thing more?


    Thanks

    jo
     
    Jo, Apr 26, 2006
    #2
    1. Advertising

  3. Jo

    Josh Twist Guest

    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/
     
    Josh Twist, Apr 26, 2006
    #3
  4. Jo

    Jo Guest

    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
     
    Jo, Apr 26, 2006
    #4
  5. Jo

    Josh Twist Guest

    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.
     
    Josh Twist, Apr 26, 2006
    #5
  6. Jo

    Jo Guest

    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?
     
    Jo, Apr 26, 2006
    #6
  7. Jo

    Josh Twist Guest

    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>
     
    Josh Twist, Apr 26, 2006
    #7
  8. Jo

    Jo Guest

    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
     
    Jo, Apr 26, 2006
    #8
  9. Jo

    Josh Twist Guest

    And you pointed wsdl.exe at this .wsdl document?
     
    Josh Twist, Apr 26, 2006
    #9
  10. Jo

    Josh Twist Guest

    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/
     
    Josh Twist, Apr 26, 2006
    #10
  11. Jo

    Jo Guest

    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
     
    Jo, Apr 26, 2006
    #11
  12. Jo

    Josh Twist Guest

    OK Jo - all sounds very odd.

    If you can post the WSDL - a link would be best.

    J
     
    Josh Twist, Apr 26, 2006
    #12
  13. Jo

    Jo Guest

    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


    Josh Twist wrote:
    > OK Jo - all sounds very odd.
    >
    > If you can post the WSDL - a link would be best.
    >
    > J
     
    Jo, Apr 27, 2006
    #13
  14. Jo

    Josh Twist Guest

    Josh Twist, Apr 27, 2006
    #14
  15. Jo

    Jo Guest

    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




    Josh Twist wrote:
    > Nope - just save the WSDL in their doc somewhere and point wsdl.exe at
    > it.
    >
    > Josh
    > http://www.thejoyofcode.com/
     
    Jo, Apr 28, 2006
    #15
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Galsaba
    Replies:
    6
    Views:
    355
    Galsaba
    Apr 17, 2004
  2. =?Utf-8?B?QWxwaGFRdXAybml0ZQ==?=

    How to allow access to HD that was used with a differnt computer

    =?Utf-8?B?QWxwaGFRdXAybml0ZQ==?=, Nov 3, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    358
    =?Utf-8?B?TGVvbiBNYXluZQ==?=
    Nov 6, 2006
  3. Tamer Ibrahim
    Replies:
    1
    Views:
    578
    JIGNESH
    Jan 17, 2008
  4. merfh3
    Replies:
    0
    Views:
    252
    merfh3
    Feb 1, 2011
  5. Replies:
    5
    Views:
    135
    Rob Meade
    Jan 15, 2005
Loading...

Share This Page