将表单数据发送到Web服务+呼叫请求

时间:2009-11-29 17:46:28

标签: php soap service

我正在创建一个将特定用户数据发送到Web服务的系统。基本上,用户输入他的姓名,电话号码和参考号码。然后他选择是立即呼叫还是在特定时间呼叫。然后将发送的此信息添加到拨号器系统,并从中生成回叫。

我已经获得了一些网站服务的文档。不幸的是,如何使用它仍然逃脱了我。我已经设计了表单并添加了所需的验证。文档补充说:

存储过程将接受字段名称和值

  • a)流程将按需执行。
  • b)标记被拒绝的记录(没有为联系号码指定的电话号码或联系号码的长度不在10到15之间)。
  • c)从参数集中插入有效的电话号码。如果不存在,Amcat将在电话号码中添加前导0(零)
  • d)将电话号码插入ContactPhoneNumbers表。
  • e)将数据插入ContactInfo&提供参数的ContactDetails表。如果未指定参数值,则将插入默认值。
  • f)如果XML指定的字段名称不存在,则Web服务将以字符串形式返回警告,但仍会输入联系人号码并将其发送到拨号。
  • g)返回所需的详细信息以进行即时拨号。

这是预期的那种XML格式......如果这很长,我很抱歉:

<?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="Call">
        <s:element name="CallResponse">
          <s:complexType>
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="CallResult"
                type="s:string" />
            </s:sequence>
          </s:complexType>
        </s:element>
        <s:element name="string" nillable="true" type="s:string" />
    </s:schema>
  </wsdl:types>
  <wsdl:message name="CallSoapIn">
    <wsdl:message name="CallSoapOut">
      <wsdl:part name="parameters" element="tns:CallResponse" />
    </wsdl:message>
    <wsdl:message name="CallHttpGetIn">
      <wsdl:part name="xmlString" type="s:string" />
    </wsdl:message>
    <wsdl:message name="CallHttpGetOut">
      <wsdl:part name="Body" element="tns:string" />
    </wsdl:message>
    <wsdl:message name="CallHttpPostIn">
      <wsdl:part name="xmlString" type="s:string" />
    </wsdl:message>
    <wsdl:message name="CallHttpPostOut">
      <wsdl:part name="Body" element="tns:string" />
    </wsdl:message>
    <wsdl:portType name="CallRequestSoap">
      <wsdl:operation name="Call">
        <wsdl:input message="tns:CallSoapIn" />
        <wsdl:output message="tns:CallSoapOut" />
      </wsdl:operation>
    </wsdl:portType>
    <wsdl:portType name="CallRequestHttpGet">
      <wsdl:operation name="Call">
    </wsdl:portType>
    <wsdl:portType name="CallRequestHttpPost">
      <wsdl:operation name="Call">
        <wsdl:input message="tns:CallHttpPostIn" />
        <wsdl:output message="tns:CallHttpPostOut" />
      </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="CallRequestSoap" type="tns:CallRequestSoap">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
      <wsdl:operation name="Call">
        <soap:operation soapAction="http://tempuri.org/Call" style="document" />
        <wsdl:input>
          <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output>
          <soap:body use="literal" />
        </wsdl:output>
      </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="CallRequestHttpGet" type="tns:CallRequestHttpGet">
      <http:binding verb="GET" />
      <wsdl:operation name="Call">
        <http:operation location="/Call" />
        <wsdl:input>
          <http:urlEncoded />
        </wsdl:input>
        <wsdl:output>
          <mime:mimeXml part="Body" />
        </wsdl:output>
      </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="CallRequestHttpPost" type="tns:CallRequestHttpPost">
      <http:binding verb="POST" />
      <wsdl:operation name="Call">
        <http:operation location="/Call" />
        <wsdl:input>
          <mime:content type="application/x-www-form-urlencoded" />
        </wsdl:input>
        <wsdl:output>
          <mime:mimeXml part="Body" />
        </wsdl:output>
      </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="CallRequest">
      <documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
      <wsdl:port name="CallRequestSoap" binding="tns:CallRequestSoap">
        <soap:address location="http://localhost/ClickToCall/CallRequest.asmx" />
      </wsdl:port>
      <wsdl:port name="CallRequestHttpGet" binding="tns:CallRequestHttpGet">
        <http:address location="http://localhost/ClickToCall/CallRequest.asmx" />
      </wsdl:port>
      <wsdl:port name="CallRequestHttpPost" binding="tns:CallRequestHttpPost">
        <http:address location="http://localhost/ClickToCall/CallRequest.asmx" />
      </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

我完全迷失在这里,我怎么做到这样的事情?我知道SOAP涉及这样的事情......但我不知道该怎么做......所以任何帮助都会很感激。

由于

萨姆

1 个答案:

答案 0 :(得分:1)

您正在尝试与SOAP Web服务进行通信。手工完成这件事非常痛苦。看一下 this作为此目的的一个示例。