SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Webservice types missing from treeview

    I have a web service that requires credentials to in the SOAP header, the method definition looks something like this:

    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
    <Credentials xmlns="http://login.com/WS">
    < userID >int</ userID >
    <password>string</password>
    </Credentials>
    </soap:Header>
    <soap:Body>
    <Agent_Find xmlns="http://login.com/WS">
    <agentNo>int</agentNo>
    </Agent_Find>
    </soap:Body>
    </soap:Envelope>

    The type definition in the WSDL looks something like this:

    <s:element name="Credentials" type="tns:Credentials" />
    <s:complexType name="Credentials">
    <s:sequence>
    <s:element minOccurs="1" maxOccurs="1" name="userID" type="s:int" />
    <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
    </s:sequence>
    <s:anyAttribute />
    </s:complexType>

    The problem arises when I try to define a credentials object:

    myObj = WebServices["WebService1"]["TypeFactory"]["Credentials"]
    myObj["userID"] = 123456789;

    I get an error assigning a value to myObj
    (An exception occurred in the "Unit1" unit at line 10:
    Microsoft JScript runtime error
    'undefined' is null or not an object)

    In the list of web services objects and methods there a several but none for the credentials.

    And if I try to just make a call to the web service:

    WebServices["WebService1"]["Agent_Find"](1);

    I get a response like this:

    <soap:Fault xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Code><soap:Value>IN VALID_CREDENTIALS</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">System.Web.Services.Protocols.Soa pException: No credentials supplied in SOAP header


    Thanks for reading all that and how can I include the SOAP header with the web service call?

  2. #2
    Junior Member
    Join Date
    Jun 2009
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Webservice types missing from treeview

    Sounds like TC7 can't handle a SOAP header....

  3. #3
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,049
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Webservice types missing from treeview

    Hi,

    Currently, TestComplete does not provide special support for web services which accept a login and a password in the request header. However, as a workaround, you can use the following approach:
    1. Use the WebServiceInfo.PrepareRequest method to prepare an XML request (see the "WebServiceInfo.PrepareRequest" help topic for more information).
    2. Modify the resulting XML data and add the needed data to the request's header. Please visit the following web page to learn how to work with the returned object:
    http://msdn.microsoft.com/en-us/libr...78(VS.85).aspx
    3. Use an object implementing the IXMLHTTPRequest interface to send the XML data to your web service. Please visit the following web page for more information:
    http://msdn.microsoft.com/en-us/libr...48(VS.85).aspx

    BTW, I have registered your request in our DB as a suggestion. Thank you.
    Regards,
    Allen - SmartBear Support

  4. #4
    Junior Member
    Join Date
    Sep 2010
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Webservice types missing from treeview

    Would it be possible to get the code that you are using Allen to add your own "items" to the soap header?

  5. #5
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,049
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Webservice types missing from treeview

    Hi Axelsson,

    I've just described the general approach and never wrote any code for that. The specific code you need depends on your XML file's format and is not related to TestComplete (except the first action which is quite simple). The objects mentioned in my post are standard Microsoft objects, so I suppose there are lots of samples showing how to perform any specific task with them (add a node/attribute, change node/attribute value, send the XML request, etc.) in the Internet.

    BTW, the second MSDN Library article mentioned in my post contains a sample script.
    Regards,
    Allen - SmartBear Support

  6. #6
    Junior Member
    Join Date
    Sep 2010
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Webservice types missing from treeview

    What methods should be possible to use in the PrepareRequestObject?
    TC shows an error message "The method not found" when I try calling a Method (with the name as displayed when using the same WSDLUrl as when adding a WebService project item.)

    set WSInfo= WebServices.CreateWebServiceInfo("URL", "ServiceName", svSoap11)

    req_object = WSInfo.PrepareRequestObject(Method)

  7. #7
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,049
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Webservice types missing from treeview

    Hi Axelsson,

    You are using a wrong method. You need to use the WebServiceInfo.PrepareRequest method instead, as it is mentioned in my original post:
    [ QUOTE ]

    1. Use the WebServiceInfo.PrepareRequest method to prepare an XML request (see the "WebServiceInfo.PrepareRequest" help topic for more information).
    2. Modify the resulting XML data and add the needed data to the request's header. Please visit the following web page to learn how to work with the returned object:
    http://msdn.microsoft.com/en-us/libr...78(VS.85).aspx
    3. Use an object implementing the IXMLHTTPRequest interface to send the XML data to your web service. Please visit the following web page for more information:
    http://msdn.microsoft.com/en-us/libr...48(VS.85).aspx


    [/ QUOTE ]
    Regards,
    Allen - SmartBear Support

  8. #8
    Junior Member
    Join Date
    Sep 2010
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Webservice types missing from treeview

    Thanks for your answear but the
    WebServiceInfoObj.PrepareRequest(MethodName, RequestObject) shall have a RequestObject.

    Thought this was created using PrepareRequestObject.
    Or how should the RequestObject be created?

  9. #9
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,049
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Webservice types missing from treeview

    Hi Axelsson,

    You are right, I missed that. When calling the PrepareRequestObject method, it returns an object containing parameters of the needed web service method as properties (see the "WebServiceInfo.PrepareRequestObject" help topic ( http://www.automatedqa.com/support/v...aspx?aid=16371 ) for more information). You need to assign the corresponding values to these parameters and then use the object to create a request with the PrepareRequest method. This method returns an XML document which is sent by the Web Services feature as the request body. At this moment, you need to modify this XML document to make it valid for your service and then send it to the service using the XMLHTTP object.

    Also, I can give you a tip that can help you debug your test. I recommend that you make use of the Evaluate dialog and its Inspect feature to see what exact values are stored in variables at run-time. Please find information on this ability in the "Using Breakpoints" (http://www.automatedqa.com/support/v...aspx?aid=11332) and "Evaluate Dialog" (http://www.automatedqa.com/support/v...aspx?aid=11331) help topics.

    In addition, we have a suggestion to implement the feature you need in TestComplete and your request has in creased the suggestion's rating. Thank you.
    Regards,
    Allen - SmartBear Support

  10. #10
    Junior Member
    Join Date
    Jan 2008
    Location
    Philadelphia
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Webservice types missing from treeview

    I also ran into this problem when trying to test our web services - we also have our credentials in the header and I was unable to see how to test the soap request. Is there any example code on how this might be done using the PrepareRequestObject? An example is not provided in the help topic.

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:21 PM.

Copyright BetaSoft Inc.