2013-02-15 63 views
2

我m如果從WebService找不到元素的Apex類型:爲userDetails

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><GetUserResponse xmlns="urn:wwservice"><userDetails xmlns="">Successfully write a web service hurray</userDetails></GetUserResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> 

但我得到的Apex型以下響應沒有發現元素:爲userDetails

這是我的WSDL文件

<?xml version="1.0" encoding="ISO-8859-1"?> 
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:wwservice" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:wwservice"> 
<types> 
<xsd:schema elementFormDefault="qualified" targetNamespace="urn:wwservice"> 
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> 
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/> 
<xsd:complexType name="GetUserRequestType"> 
    <xsd:all> 
    <xsd:element name="Username" type="xsd:string" form="unqualified"/> 
    <xsd:element name="Password" type="xsd:string" form="unqualified"/> 
    </xsd:all> 
</xsd:complexType> 
<xsd:complexType name="GetUserResponseType"> 
    <xsd:all> 
    <xsd:element name="userDetails" type="xsd:string" form="unqualified"/> 
    </xsd:all> 
</xsd:complexType> 
<xsd:element name="GetUser" type="tns:GetUserRequestType"/> 
<xsd:element name="GetUserResponse" type="tns:GetUserResponseType"/> 
</xsd:schema> 
</types> 
<message name="GetUserRequest"> 
    <part name="parameters" element="tns:GetUser"/></message> 
<message name="GetUserResponse"> 
    <part name="parameters" element="tns:GetUserResponse"/></message> 
<portType name="PsocialPortType"> 
    <operation name="GetUser"> 
    <input message="tns:GetUserRequest"/> 
    <output message="tns:GetUserResponse"/> 
    </operation> 
</portType> 
<binding name="PsocialBinding" type="tns:PsocialPortType"> 
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <operation name="GetUser"> 
    <soap:operation soapAction="urn:wwservice#GetUser" style="document"/> 
    <input><soap:body use="literal" namespace="urn:wwservice"/></input> 
    <output><soap:body use="literal" namespace="urn:wwservice"/></output> 
    </operation> 
</binding> 
<service name="Psocial"> 
    <port name="PsocialPort" binding="tns:PsocialBinding"> 
    <soap:address location="http://example.com/webservice/wwservice.php"/> 
    </port> 
</service> 
</definitions> 

請讓我知道我錯了什麼地方

我使用它來cre吃了WSDL

$server = new soap_server(); 
    // Changed for coupons data start 
    $server->soap_defencoding = 'UTF-8'; 
    $server->decode_utf8 = false; 
    // Changed for coupons data end 

    //$server->configureWSDL('m-way', 'urn:wwservice'); 
    $server->configureWSDL('Psocial', 'urn:wwservice',false,'document'); 


    // New function for spiff 
    $server->register("GetUser", 
    array('Username'=>'xsd:string','Password'=>'xsd:string'), 
    array('userDetails'=>'xsd:string'), 
    'urn:wwservice', 
    'urn:wwservice#GetUser', 'document', 'literal' 
    ); 



    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA)? $HTTP_RAW_POST_DATA : file_get_contents('php://input'); 
    $server->service($HTTP_RAW_POST_DATA); 
+0

我得到了剛剛替換的答案
private String [] apex_schema_type_info = new String [] {'urn:wwservice','true','false'}; private String [] apex_schema_type_info = new String [] {'urn:wwservice','false','false'}; 'true'from false and it worked so new statement – 2013-02-15 10:10:54

回答

2

的問題是,你不會在WSDL它的描述相匹配的SOAP響應,WSDL具有elementFormDefault="qualified"的架構,它說,子元素將在命名空間中,例如其並稱反應應該是

<GetUserResponse xmlns="urn:wwservice"> 
    <userDetails>Hello</userDetails> 
</GetUserResponse> 

但你的實際響應具有

<GetUserResponse xmlns="urn:wwservice"> 
    <userDetails xmlns="">Successfully write a web service hurray</userDetails> 
</GetUserResponse> 

注爲爲userDetails元素的命名空間是如何不同。您應該更新WSDL以表示elementForDefault =「unqualified」或更新Web服務以在userDetails元素上返回正確的名稱空間。

+0

thanks for your reply – 2013-02-20 05:29:18

相關問題