[ptt-users] SOAP agent help

Carl Herder carl_herder at yahoo.com
Wed Dec 13 15:04:08 PST 2006


Skipped content of type multipart/alternative-------------- next part --------------
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
      <s:element name="GetOrder">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="orderId" type="s:int" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetOrderResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetOrderResult" type="tns:OrderInfo" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="OrderInfo">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="OrderId" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="Date" type="s:dateTime" />
          <s:element minOccurs="0" maxOccurs="1" name="UserId" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="CreditCard" type="tns:CreditCardInfo" />
          <s:element minOccurs="0" maxOccurs="1" name="BillingAddress" type="tns:AddressInfo" />
          <s:element minOccurs="0" maxOccurs="1" name="ShippingAddress" type="tns:AddressInfo" />
          <s:element minOccurs="1" maxOccurs="1" name="OrderTotal" type="s:decimal" />
          <s:element minOccurs="0" maxOccurs="1" name="LineItems" type="tns:ArrayOfLineItemInfo" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="CreditCardInfo">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="CardType" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="CardNumber" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="CardExpiration" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="AddressInfo">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="FirstName" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="LastName" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Address1" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Address2" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="City" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="State" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Zip" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Phone" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="ArrayOfLineItemInfo">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="LineItemInfo" nillable="true" type="tns:LineItemInfo" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="LineItemInfo">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="ItemId" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="Line" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="Quantity" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="Price" type="s:decimal" />
        </s:sequence>
      </s:complexType>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="GetOrderSoapIn">
    <wsdl:part name="parameters" element="tns:GetOrder" />
  </wsdl:message>
  <wsdl:message name="GetOrderSoapOut">
    <wsdl:part name="parameters" element="tns:GetOrderResponse" />
  </wsdl:message>
  <wsdl:portType name="WebServicesSoap">
    <wsdl:operation name="GetOrder">
      <wsdl:input message="tns:GetOrderSoapIn" />
      <wsdl:output message="tns:GetOrderSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="WebServicesSoap" type="tns:WebServicesSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
    <wsdl:operation name="GetOrder">
      <soap:operation soapAction="http://tempuri.org/GetOrder" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="WebServices">
    <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Retrieves order information for a given order ID.</documentation>
    <wsdl:port name="WebServicesSoap" binding="tns:WebServicesSoap">
      <soap:address location="http://localhost/MSPetShop/WebServices.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
-------------- next part --------------
# Agent name: 
# Created on: 
# Author:

print "Agent running: "
print "Description: "
print


# Import tells TestMaker where to find Tool objects
from com.pushtotest.tool.protocolhandler import ProtocolHandler, SOAPHeader, SOAPBody, SOAPProtocol
from com.pushtotest.tool.response import Response


# Variables definitions

Timing1 = 0.0


# Main body of agent

print "Processing..."

# WebServices SOAP Script 
# WebServicesSoap: http://tempuri.org/:WebServicesSoap

soap = ProtocolHandler.getProtocol("soap")
soap.setUrl("http://localhost/MSPetShop/WebServices.asmx")
body = ProtocolHandler.getBody("soap")
body.setMethod("GetOrder")
# GetOrderSoapIn
body.addParameter("parameters", "")
soap.setBody(body)
response = soap.connect()


# Report results

print
print "That took ", Timing1, " milliseconds to complete."
print
print "Agent ended."


More information about the Users mailing list