使用SOAP与WSDL通信,我不';我不知道如何正确地形成SOAP,以便在远程服务器中与WSDL交互

使用SOAP与WSDL通信,我不';我不知道如何正确地形成SOAP,以便在远程服务器中与WSDL交互,soap,wsdl,axis2,Soap,Wsdl,Axis2,我必须向使用Axis2的web服务发出请求,我离它太近了,无法让它工作,但我不断收到错误消息,我确信这是在我的SOAP XML的构造中。这就是肥皂: <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://www.w3.org/2001/12/soap-en

我必须向使用Axis2的web服务发出请求,我离它太近了,无法让它工作,但我不断收到错误消息,我确信这是在我的SOAP XML的构造中。这就是肥皂:

<?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
        <soap:Header>
            <RequestsoapHeader>
                <spId>SPID</spId>
                <spPassword>RandomPass</spPassword>
                <timeStamp>20130115160251</timeStamp>
            </RequestsoapHeader>
        </soap:Header>
        <soap:Body>
            <operation>
                <name>getSPToken</name>
                <input>http://zzz.zzz.zzz.zzz/my/redirection/url/</input>
            </operation>
        </soap:Body>
    </soap:Envelope>

SPID
随机通行证
20130115160251
getSPToken
http://zzz.zzz.zzz.zzz/my/redirection/url/
更新!!!!现在的肥皂是这样的:

<?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
        <soap:Header>
            <RequestsoapHeader>
                <spId>SPID</spId>
                <spPassword>RandomPass</spPassword>
                <timeStamp>20130115160251</timeStamp>
            </RequestsoapHeader>
        </soap:Header>
        <soap:Body>
            <getSPTokenRequest>
                <SPredirectURL>http://zzz.zzz.zzz.zzz/my/redirection/url/</SPredirectURL>
            </getSPTokenRequest>
        </soap:Body>
    </soap:Envelope>

SPID
随机通行证
20130115160251
http://zzz.zzz.zzz.zzz/my/redirection/url/
我无法修复的部分是主体,我尝试以不同的方式调用操作,例如,我使用了
,而不是
,我也尝试不使用操作,并创建了一个名为
的标记,但没有任何效果

这是描述我试图在Web服务中调用的操作的WSDL部分:

    <wsdl:operation name="getSPToken">
        <soap:operation soapAction="" style="document"/>
        <wsdl:input>
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal"/>
        </wsdl:output>
        <wsdl:fault name="ServiceException">
            <soap:fault name="ServiceException" use="literal"/>
        </wsdl:fault>
        <wsdl:fault name="PolicyException">
            <soap:fault name="PolicyException" use="literal"/>
        </wsdl:fault>
    </wsdl:operation>

更新!!!这是我以前没有发布的接口XML(WSDL的一部分):

<wsdl:types>
    <xsd:schema elementFormDefault="qualified" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
        targetNamespace="http://www.csapi.org/schema/parlayx/sicoweb/v1_0/local">
        <xsd:element name="getSPTokenRequest" type="osg_sicoweb_local_xsd:getSPTokenRequest"/>
        <xsd:complexType name="getSPTokenRequest">
            <xsd:sequence>
                <xsd:element name="SPredirectURL"
                    type="xsd:string" maxOccurs="1" minOccurs="1">
                    <xsd:annotation>
                        <xsd:documentation></xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:element name="getSPTokenResponse" type="osg_sicoweb_local_xsd:getSPTokenResponse"/>
        <xsd:complexType name="getSPTokenResponse">
            <xsd:sequence>
                <xsd:element name="SPToken" type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:schema>
</wsdl:types>

这就是我得到的回应:

HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=UTF-8
Date: Tue, 15 Jan 2013 21:10:49 GMT
Connection: close
<?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <soapenv:Body>
            <soapenv:Fault xmlns:axis2ns73="http://schemas.xmlsoap.org/soap/envelope/">
                <faultcode>axis2ns73:Client</faultcode>
                <faultstring>The endpoint reference (EPR) for the Operation not found is http://xxx.xxx.xxx.xxx:xxx/path/to/service/ and the WSA Action = </faultstring>
                <detail />
            </soapenv:Fault>
        </soapenv:Body>
    </soapenv:Envelope>
HTTP/1.1500内部服务器错误
服务器:ApacheCoote/1.1
内容类型:text/xml;字符集=UTF-8
日期:2013年1月15日星期二格林威治时间21:10:49
连接:关闭
axis2ns73:客户端
找不到操作的端点引用(EPR)http://xxx.xxx.xxx.xxx:xxx/path/to/service/ 而WSA操作=
更新!!!!随着新的变化,我得到的回应是:

<?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <soapenv:Body>
            <soapenv:Fault>
                <faultcode>soapenv:Server</faultcode>
                <faultstring>org.apache.axis2.databinding.ADBException: Unexpected subelement getSPTokenRequest</faultstring>
                <detail />
            </soapenv:Fault>
        </soapenv:Body>
    </soapenv:Envelope>

soapenv:服务器
org.apache.axis2.databinding.ADBException:意外的子元素getSPTokenRequest

操作
getSPToken
将接收一个名为
SPredirectURL
的参数,该参数包含重定向URL,请帮助。

尝试以下操作之一:

<soap:Body>
  <SPredirectURL>http://zzz.zzz.zzz.zzz/my/redirection/url/</SPredirectURL>
</soap:Body>

<soap:Body>
  <getSPTokenRequest xmlns="http://www.csapi.org/schema/parlayx/sicoweb/v1_0/local">
    <SPredirectURL>http://zzz.zzz.zzz.zzz/my/redirection/url/</SPredirectURL>
  </getSPTokenRequest>
</soap:Body>

http://zzz.zzz.zzz.zzz/my/redirection/url/
http://zzz.zzz.zzz.zzz/my/redirection/url/
基于WSDL片段,web服务端点正在使用消息的文档/文字约定,但如果没有WSDL消息声明,则不清楚预期的是“裸”(第一个示例)还是“包装”(第二个示例)版本。邮局在这个地址(http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/)深入了解WSDL描述的各种方言

更新: 根据wsdl:types部分内的模式,服务所需元素的完全限定名(基于模式元素的声明targetNamespace属性)为{getSPTokenRequest}

建立该名称的一种方法(内联命名空间声明)显示在上面更新的第二个正文中


返回下一次迭代。

我尝试了你的答案,但没有得到预期的结果。它改为:soapenv:Server org.apache.axis2.databinding.ADBException:Unexpected subelement getSPTokenRequest我回答了一个类似的问题。你可能想看看这个