0

我需要完全按照下面的方式传递 SOAP 调用并使用 isEmailAvailableResponse 获取响应但看起来 PHP 不喜欢命名空间或其他东西,我不断收到下面列出的错误我尝试手动传递 XML 并且确实有效但我'想尝试让它与 PHP SOAP 客户端一起工作

<?php

$client = new SoapClient("http://192.168.35.123:8080/iBossCustomer/Email?wsdl", array('trace' => 1));

$arg = array("emailAddressName" => 'helloasdadsad@iburst.co.za');
$params = array("arg0" => $arg);

$client->isEmailAvailable($params);

-------------- XML ------------

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ema="http://email.boss.arc/">
   <soapenv:Header/>
   <soapenv:Body>
      <ema:isEmailAvailable>
         <!--Optional:-->
         <arg0>
            <emailAddressName>helloasdadsad@iburst.co.za</emailAddressName>
         </arg0>
      </ema:isEmailAvailable>
   </soapenv:Body>
</soapenv:Envelope>

------------- PHP错误 ---------

捕获的异常:SOAP-ERROR:编码:对象没有“成功”属性

------- WSDL 文件 -------

<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://email.boss.arc/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://email.boss.arc/" name="Email">
<types>
<xsd:schema>
<xsd:import namespace="http://webservice.gateway.email.service.isp.rogueware.org/" schemaLocation="http://192.168.35.123:8080/iBossCustomer/Email?xsd=1"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://email.boss.arc/" schemaLocation="http://192.168.35.123:8080/iBossCustomer/Email?xsd=2"/>
</xsd:schema>
</types>
<message name="DeleteEmailAccount">
<part name="parameters" element="tns:DeleteEmailAccount"/>
</message>
<message name="DeleteEmailAccountResponse">
<part name="parameters" element="tns:DeleteEmailAccountResponse"/>
</message>
<message name="ReserveEmailAddress">
<part name="parameters" element="tns:ReserveEmailAddress"/>
</message>
<message name="ReserveEmailAddressResponse">
<part name="parameters" element="tns:ReserveEmailAddressResponse"/>
</message>
<message name="CreateEmailDomain">
<part name="parameters" element="tns:CreateEmailDomain"/>
</message>
<message name="CreateEmailDomainResponse">
<part name="parameters" element="tns:CreateEmailDomainResponse"/>
</message>
<message name="isEmailDomainAvailable">
<part name="parameters" element="tns:isEmailDomainAvailable"/>
</message>
<message name="isEmailDomainAvailableResponse">
<part name="parameters" element="tns:isEmailDomainAvailableResponse"/>
</message>
<message name="AddEmailAccountNickname">
<part name="parameters" element="tns:AddEmailAccountNickname"/>
</message>
<message name="AddEmailAccountNicknameResponse">
<part name="parameters" element="tns:AddEmailAccountNicknameResponse"/>
</message>
<message name="GetEmailAccountAttributes">
<part name="parameters" element="tns:GetEmailAccountAttributes"/>
</message>
<message name="GetEmailAccountAttributesResponse">
<part name="parameters" element="tns:GetEmailAccountAttributesResponse"/>
</message>
<message name="GetEmailAccountInformation">
<part name="parameters" element="tns:GetEmailAccountInformation"/>
</message>
<message name="GetEmailAccountInformationResponse">
<part name="parameters" element="tns:GetEmailAccountInformationResponse"/>
</message>
<message name="SetEmailDomainMaxAccountNames">
<part name="parameters" element="tns:SetEmailDomainMaxAccountNames"/>
</message>
<message name="SetEmailDomainMaxAccountNamesResponse">
<part name="parameters" element="tns:SetEmailDomainMaxAccountNamesResponse"/>
</message>
<message name="SetEmailAccountSpamFolderEnabled">
<part name="parameters" element="tns:SetEmailAccountSpamFolderEnabled"/>
</message>
<message name="SetEmailAccountSpamFolderEnabledResponse">
<part name="parameters" element="tns:SetEmailAccountSpamFolderEnabledResponse"/>
</message>
<message name="SetEmailAccountForwardAddress">
<part name="parameters" element="tns:SetEmailAccountForwardAddress"/>
</message>
<message name="SetEmailAccountForwardAddressResponse">
<part name="parameters" element="tns:SetEmailAccountForwardAddressResponse"/>
</message>
<message name="SetEmailAccountLocalDeliveryEnabled">
<part name="parameters" element="tns:SetEmailAccountLocalDeliveryEnabled"/>
</message>
<message name="SetEmailAccountLocalDeliveryEnabledResponse">
<part name="parameters" element="tns:SetEmailAccountLocalDeliveryEnabledResponse"/>
</message>
<message name="SetEmailAccountPassword">
<part name="parameters" element="tns:SetEmailAccountPassword"/>
</message>
<message name="SetEmailAccountPasswordResponse">
<part name="parameters" element="tns:SetEmailAccountPasswordResponse"/>
</message>
<message name="RemoveEmailAccountNickName">
<part name="parameters" element="tns:RemoveEmailAccountNickName"/>
</message>
<message name="RemoveEmailAccountNickNameResponse">
<part name="parameters" element="tns:RemoveEmailAccountNickNameResponse"/>
</message>
<message name="CreateEmailAddress">
<part name="parameters" element="tns:CreateEmailAddress"/>
</message>
<message name="CreateEmailAddressResponse">
<part name="parameters" element="tns:CreateEmailAddressResponse"/>
</message>
<message name="CreateReservedEmailAddress">
<part name="parameters" element="tns:CreateReservedEmailAddress"/>
</message>
<message name="CreateReservedEmailAddressResponse">
<part name="parameters" element="tns:CreateReservedEmailAddressResponse"/>
</message>
<message name="isEmailAvailable">
<part name="parameters" element="tns:isEmailAvailable"/>
</message>
<message name="isEmailAvailableResponse">
<part name="parameters" element="tns:isEmailAvailableResponse"/>
</message>
<message name="UpdateEmailAttribute">
<part name="parameters" element="tns:UpdateEmailAttribute"/>
</message>
<message name="UpdateEmailAttributeResponse">
<part name="parameters" element="tns:UpdateEmailAttributeResponse"/>
</message>
<portType name="Email">
<operation name="DeleteEmailAccount">
<input message="tns:DeleteEmailAccount"/>
<output message="tns:DeleteEmailAccountResponse"/>
</operation>
<operation name="ReserveEmailAddress">
<input message="tns:ReserveEmailAddress"/>
<output message="tns:ReserveEmailAddressResponse"/>
</operation>
<operation name="CreateEmailDomain">
<input message="tns:CreateEmailDomain"/>
<output message="tns:CreateEmailDomainResponse"/>
</operation>
<operation name="isEmailDomainAvailable">
<input message="tns:isEmailDomainAvailable"/>
<output message="tns:isEmailDomainAvailableResponse"/>
</operation>
<operation name="AddEmailAccountNickname">
<input message="tns:AddEmailAccountNickname"/>
<output message="tns:AddEmailAccountNicknameResponse"/>
</operation>
<operation name="GetEmailAccountAttributes">
<input message="tns:GetEmailAccountAttributes"/>
<output message="tns:GetEmailAccountAttributesResponse"/>
</operation>
<operation name="GetEmailAccountInformation">
<input message="tns:GetEmailAccountInformation"/>
<output message="tns:GetEmailAccountInformationResponse"/>
</operation>
<operation name="SetEmailDomainMaxAccountNames">
<input message="tns:SetEmailDomainMaxAccountNames"/>
<output message="tns:SetEmailDomainMaxAccountNamesResponse"/>
</operation>
<operation name="SetEmailAccountSpamFolderEnabled">
<input message="tns:SetEmailAccountSpamFolderEnabled"/>
<output message="tns:SetEmailAccountSpamFolderEnabledResponse"/>
</operation>
<operation name="SetEmailAccountForwardAddress">
<input message="tns:SetEmailAccountForwardAddress"/>
<output message="tns:SetEmailAccountForwardAddressResponse"/>
</operation>
<operation name="SetEmailAccountLocalDeliveryEnabled">
<input message="tns:SetEmailAccountLocalDeliveryEnabled"/>
<output message="tns:SetEmailAccountLocalDeliveryEnabledResponse"/>
</operation>
<operation name="SetEmailAccountPassword">
<input message="tns:SetEmailAccountPassword"/>
<output message="tns:SetEmailAccountPasswordResponse"/>
</operation>
<operation name="RemoveEmailAccountNickName">
<input message="tns:RemoveEmailAccountNickName"/>
<output message="tns:RemoveEmailAccountNickNameResponse"/>
</operation>
<operation name="CreateEmailAddress">
<input message="tns:CreateEmailAddress"/>
<output message="tns:CreateEmailAddressResponse"/>
</operation>
<operation name="CreateReservedEmailAddress">
<input message="tns:CreateReservedEmailAddress"/>
<output message="tns:CreateReservedEmailAddressResponse"/>
</operation>
<operation name="isEmailAvailable">
<input message="tns:isEmailAvailable"/>
<output message="tns:isEmailAvailableResponse"/>
</operation>
<operation name="UpdateEmailAttribute">
<input message="tns:UpdateEmailAttribute"/>
<output message="tns:UpdateEmailAttributeResponse"/>
</operation>
</portType>
<binding name="EmailPortBinding" type="tns:Email">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="DeleteEmailAccount">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="ReserveEmailAddress">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="CreateEmailDomain">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="isEmailDomainAvailable">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="AddEmailAccountNickname">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="GetEmailAccountAttributes">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="GetEmailAccountInformation">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="SetEmailDomainMaxAccountNames">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="SetEmailAccountSpamFolderEnabled">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="SetEmailAccountForwardAddress">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="SetEmailAccountLocalDeliveryEnabled">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="SetEmailAccountPassword">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="RemoveEmailAccountNickName">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="CreateEmailAddress">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="CreateReservedEmailAddress">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="isEmailAvailable">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="UpdateEmailAttribute">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="Email">
<port name="EmailPort" binding="tns:EmailPortBinding">
<soap:address location="http://192.168.35.123:8080/iBossCustomer/Email"/>
</port>
</service>
</definitions>

`

4

1 回答 1

0

它适用于手动 XML,因为这将绕过 WSDL。xsd2 中的 WSDL 信息看起来不正确,您似乎正在使用复杂类型emailDdeDTO,因为它适合多种 Web 服务方法的所有输入。

这是您定义为 的输入的内容isEmailAvailable()

<xs:element name="customerNo" type="xs:string" minOccurs="0"/>
<xs:element name="customerObjNum" type="xs:long" minOccurs="0"/>
<xs:element name="domainName" type="xs:string" minOccurs="0"/>
<xs:element name="emailAddressName" type="xs:string" minOccurs="0"/>
<xs:element name="emailAddressReservedNo" type="xs:long"/>
<xs:element name="errorMessage" type="xs:string" minOccurs="0"/>
<xs:element name="errorStackTrace" type="xs:string" minOccurs="0"/>
<xs:element name="externalReference" type="xs:string" minOccurs="0"/>
<xs:element name="isEmailAddressAvailable" type="xs:boolean" minOccurs="0"/>
<xs:element name="isFreeEmail" type="xs:boolean" minOccurs="0"/>
<xs:element name="isSuccessful" type="xs:boolean" minOccurs="0"/>
<xs:element name="password" type="xs:string" minOccurs="0"/>
<xs:element name="reservationReference" type="xs:long"/>
<xs:element name="subscriberNo" type="xs:string" minOccurs="0"/>
<xs:element name="subscriberObjNum" type="xs:long" minOccurs="0"/>

上面的复杂类型有一个扩展,abstractDTOut它也导入了这些元素:

<xs:element name="failureDescription" type="xs:string" minOccurs="0"/>
<xs:element name="failureType" type="xs:int" minOccurs="0"/>
<xs:element name="successful" type="xs:boolean"/>

注意successful没有minOccurs=0属性?这就是你得到异常的原因successful property missing

最好为每个方法的输入结构有一个单独的复杂类型定义,但快速解决方法是添加minOccurs="0"到上面的成功元素。

于 2012-05-09T21:54:25.710 回答