当前位置: 首页 > 知识库问答 >
问题:

SOAP请求返回了wsdl,而不是预期的SOAP响应

姚建树
2023-03-14

我的SOAP请求有问题。当我尝试向服务器发出下面的肥皂请求时,它会返回预期的结果。

位置:https://YOUR_SERVER/apitransactional/service/TransactionalService?wsdl

输入:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                      xmlns:api="http://api.service.apitransactional.emailvision.com/">
    <soapenv:Header/>
    <soapenv:Body>
        <api:openApiConnection>
            <login>usernaem</login>
            <pwd>password</pwd>
            <key>security-key</key>
        </api:openApiConnection>
    </soapenv:Body>
    </soapenv:Envelope>

输出:

<soap:Envelope>
    <soap:Body>
        <ns2:openApiConnectionResponse>
            <return>G9X7CsNn3HisxFdwAu4W76mBewQgH9WW-3CyeO9WBMiHXX_u9ufLHDkA-NypiiYFGh7FLbEz2_c1YonjauDs7Jhk9DGvGNSTLMTjdz5wT2V20E4m3axKPzEnjrvzC63ItFzBIYIeYXHxjKf3w9Yxmmhz5SSeXg</return>
        </ns2:openApiConnectionResponse>
    </soap:Body>
</soap:Envelope>

它返回此连接的令牌。

但是当我尝试处理下面的请求时,它返回整个wsdl文件,而不是成功/失败响应。

地点:http://api.notificationmessaging.com/NMSOAP/NotificationService?wsdl

输入:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:api="http://api.service.nsapi.emailvision.com/">
    <soapenv:Header/>
    <soapenv:Body>
        <api:sendObjectsWithFullStatus>
            <arg0>
                <sendrequest>
                    <content>
                        <entry>
                            <key>1</key>
                            <value>>
                                <![CDATA[
<table width="600">
<tr>
<td>
<font size="2" face="Arial">Our powerful algorithms
already found a matching profile that matches your criteria:
<br>Celina72&nbsp;</font>
<img src="http://mypath/to/my/image.gif" width="50"
height="50" border="0" />
</td>]]></value>
                        </entry>
                    </content>
                    <dyn>
                        <entry>
                            <key>firstname</key>
                            <value>john</value>
                        </entry>
                    </dyn>
                    <email>jblum@flowerpowershop.biz</email>
                    <encrypt>BdX7CqkmjTHtxWEKB5QK6MzXKkx6HK3E8guM</encrypt>
                    <notificationId>1234</notificationId>
                    <random>4A776E3602000078</random>
                    <senddate>2008-12-12T00:00:00</senddate>
                    <synchrotype>NOTHING</synchrotype>
                    <uidkey>EMAIL</uidkey>
                </sendrequest>
                <sendrequest>
                    <content>
                        <entry>
                            <key>1</key>
                            <value>>
                                <![CDATA[
<table width="600">
<tr>
<td>
<font size="2" face="Arial">Our powerful
algorithms already found a matching profile that matches your criteria:
<br>Celina72&nbsp;</font>
<img src="http://mypath/to/my/image.gif" width-
h="50" height="50" border="0" />
</td>]]></value>
                        </entry>
                    </content>
                    <dyn>
                        <entry>
                            <key>firstname</key>
                            <value>David</value>
                        </entry>
                    </dyn>
                    <email>dcoulon@flowerpowershop.biz</email>
                    <encrypt>BdX7CqkmjTHtxWEKB5QK6MzXKkx6HK3E8guM</encrypt>
                    <notificationId>1234</notificationId>
                    <random>4A776E3602000078</random>
                    <senddate>2008-12-12T00:00:00</senddate>
                    <synchrotype>UPDATE</synchrotype>
                    <uidkey>EMAIL</uidkey>
                </sendrequest>
            </arg0>
        </api:sendObjectsWithFullStatus>
    </soapenv:Body>
</soapenv:Envelope>

输出:

<?xml version='1.0' encoding='UTF-8' ?>
<wsdl:definitions name="NotificationServiceService" targetNamespace="http://api.service.nsapi.emailvision.com/">
<wsdl:types>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://api.service.nsapi.emailvision.com/">
        <xs:element name="MultiSendRequest" type="tns:multiSendRequest" />
        <xs:element name="MultiSendRequestResponse" type="tns:multiSendRequestResponse" />
        <xs:element name="getSendRequestById" type="tns:getSendRequestById" />
        <xs:element name="getSendRequestByIdResponse" type="tns:getSendRequestByIdResponse" />
        <xs:element name="notificationExceptionDetails" type="tns:notificationExceptionDetails" />
        <xs:element name="sendObject" type="tns:sendObject" />
        <xs:element name="sendObjectResponse" type="tns:sendObjectResponse" />
        <xs:element name="sendObjects" type="tns:sendObjects" />
        <xs:element name="sendObjectsResponse" type="tns:sendObjectsResponse" />
        <xs:element name="sendObjectsWithFullStatus" type="tns:sendObjectsWithFullStatus" />
        <xs:element name="sendObjectsWithFullStatusResponse" type="tns:sendObjectsWithFullStatusResponse" />
        <xs:element name="sendrequest" type="tns:sendRequest" />
        <xs:element name="sendrequestresponse" type="tns:sendRequestResponse" />
        <xs:complexType name="sendObjects">
            <xs:sequence>
                <xs:element minOccurs="0" name="arg0" type="tns:multiSendRequest" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="multiSendRequest">
            <xs:sequence>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="sendrequest" nillable="true" type="tns:sendRequest" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="sendRequest">
            <xs:sequence>
                <xs:element name="content">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element maxOccurs="unbounded" minOccurs="0" name="entry">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element minOccurs="0" name="key" type="xs:int" />
                                        <xs:element minOccurs="0" name="value" type="xs:string" />
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="dyn">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element maxOccurs="unbounded" minOccurs="0" name="entry">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element minOccurs="0" name="key" type="xs:string" />
                                        <xs:element minOccurs="0" name="value" type="xs:string" />
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element minOccurs="0" name="email" type="xs:string" />
                <xs:element minOccurs="0" name="encrypt" type="xs:string" />
                <xs:element name="notificationId" type="xs:long" />
                <xs:element minOccurs="0" name="random" type="xs:string" />
                <xs:element minOccurs="0" name="senddate" type="xs:dateTime" />
                <xs:element minOccurs="0" name="synchrotype" type="tns:synchroType" />
                <xs:element minOccurs="0" name="uidkey" type="xs:string" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="sendObjectsResponse">
            <xs:sequence>
                <xs:element minOccurs="0" name="return" type="tns:multiSendRequestResponse" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="multiSendRequestResponse">
            <xs:sequence>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="element" nillable="true" type="tns:notificationServiceResponse" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="notificationServiceResponse">
            <xs:sequence>
                <xs:element minOccurs="0" name="result" type="xs:anyType" />
            </xs:sequence>
            <xs:attribute name="email" type="xs:string" />
            <xs:attribute name="responseStatus" type="xs:string" />
        </xs:complexType>
        <xs:complexType name="notificationExceptionDetails">
            <xs:sequence>
                <xs:element minOccurs="0" name="description" type="xs:string" />
                <xs:element maxOccurs="unbounded" minOccurs="0" name="fields" nillable="true" type="xs:string" />
                <xs:element minOccurs="0" name="status" type="xs:string" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="getSendRequestById">
            <xs:sequence>
                <xs:element name="arg0" type="xs:long" />
                <xs:element minOccurs="0" name="arg1" type="xs:string" />
                <xs:element minOccurs="0" name="arg2" type="xs:string" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="getSendRequestByIdResponse">
            <xs:sequence>
                <xs:element minOccurs="0" name="return" type="tns:sendRequestResponse" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="sendRequestResponse">
            <xs:sequence>
                <xs:element minOccurs="0" name="email" type="xs:string" />
                <xs:element name="id" type="xs:long" />
                <xs:element name="notificationId" type="xs:long" />
                <xs:element minOccurs="0" name="processDate" type="xs:dateTime" />
                <xs:element minOccurs="0" name="requestDate" type="xs:dateTime" />
                <xs:element minOccurs="0" name="sendDate" type="xs:dateTime" />
                <xs:element minOccurs="0" name="status" type="xs:string" />
                <xs:element minOccurs="0" name="UId" type="xs:string" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="sendObject">
            <xs:sequence>
                <xs:element minOccurs="0" name="arg0" type="tns:sendRequest" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="sendObjectResponse">
            <xs:sequence>
                <xs:element minOccurs="0" name="return" type="xs:string" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="sendObjectsWithFullStatus">
            <xs:sequence>
                <xs:element minOccurs="0" name="arg0" type="tns:multiSendRequest" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="sendObjectsWithFullStatusResponse">
            <xs:sequence>
                <xs:element minOccurs="0" name="return" type="tns:multiSendRequestResponse" />
            </xs:sequence>
        </xs:complexType>
        <xs:simpleType name="synchroType">
            <xs:restriction base="xs:string">
                <xs:enumeration value="NOTHING" />
                <xs:enumeration value="INSERT" />
                <xs:enumeration value="UPDATE" />
                <xs:enumeration value="INSERT_UPDATE" />
            </xs:restriction>
        </xs:simpleType>
    </xs:schema>
    <xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://exceptions.service.nsapi.emailvision.com/">
        <xsd:element name="NotificationServiceException" nillable="true" type="ns0:notificationExceptionDetails" />
    </xsd:schema>
</wsdl:types>
<wsdl:message name="getSendRequestByIdResponse">
    <wsdl:part element="tns:getSendRequestByIdResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObjectsWithFullStatus">
    <wsdl:part element="tns:sendObjectsWithFullStatus" name="parameters" />
</wsdl:message>
<wsdl:message name="NotificationServiceException">
    <wsdl:part element="ns1:NotificationServiceException" name="NotificationServiceException" />
</wsdl:message>
<wsdl:message name="sendObjectResponse">
    <wsdl:part element="tns:sendObjectResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObjectsResponse">
    <wsdl:part element="tns:sendObjectsResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="getSendRequestById">
    <wsdl:part element="tns:getSendRequestById" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObjectsWithFullStatusResponse">
    <wsdl:part element="tns:sendObjectsWithFullStatusResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObjects">
    <wsdl:part element="tns:sendObjects" name="parameters" />
</wsdl:message>
<wsdl:message name="sendObject">
    <wsdl:part element="tns:sendObject" name="parameters" />
</wsdl:message>
<wsdl:portType name="NotificationService">
    <wsdl:operation name="sendObjects">
        <wsdl:input message="tns:sendObjects" name="sendObjects" />
        <wsdl:output message="tns:sendObjectsResponse" name="sendObjectsResponse" />
        <wsdl:fault message="tns:NotificationServiceException" name="NotificationServiceException" />
    </wsdl:operation>
    <wsdl:operation name="getSendRequestById">
        <wsdl:input message="tns:getSendRequestById" name="getSendRequestById" />
        <wsdl:output message="tns:getSendRequestByIdResponse" name="getSendRequestByIdResponse" />
        <wsdl:fault message="tns:NotificationServiceException" name="NotificationServiceException" />
    </wsdl:operation>
    <wsdl:operation name="sendObject">
        <wsdl:input message="tns:sendObject" name="sendObject" />
        <wsdl:output message="tns:sendObjectResponse" name="sendObjectResponse" />
        <wsdl:fault message="tns:NotificationServiceException" name="NotificationServiceException" />
    </wsdl:operation>
    <wsdl:operation name="sendObjectsWithFullStatus">
        <wsdl:input message="tns:sendObjectsWithFullStatus" name="sendObjectsWithFullStatus" />
        <wsdl:output message="tns:sendObjectsWithFullStatusResponse" name="sendObjectsWithFullStatusResponse" />
        <wsdl:fault message="tns:NotificationServiceException" name="NotificationServiceException" />
    </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="NotificationServiceServiceSoapBinding" type="tns:NotificationService">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="sendObjects">
        <soap:operation soapAction="" style="document" />
        <wsdl:input name="sendObjects">
            <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output name="sendObjectsResponse">
            <soap:body use="literal" />
        </wsdl:output>
        <wsdl:fault name="NotificationServiceException">
            <soap:fault name="NotificationServiceException" use="literal" />
        </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="getSendRequestById">
        <soap:operation soapAction="" style="document" />
        <wsdl:input name="getSendRequestById">
            <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output name="getSendRequestByIdResponse">
            <soap:body use="literal" />
        </wsdl:output>
        <wsdl:fault name="NotificationServiceException">
            <soap:fault name="NotificationServiceException" use="literal" />
        </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="sendObject">
        <soap:operation soapAction="" style="document" />
        <wsdl:input name="sendObject">
            <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output name="sendObjectResponse">
            <soap:body use="literal" />
        </wsdl:output>
        <wsdl:fault name="NotificationServiceException">
            <soap:fault name="NotificationServiceException" use="literal" />
        </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="sendObjectsWithFullStatus">
        <soap:operation soapAction="" style="document" />
        <wsdl:input name="sendObjectsWithFullStatus">
            <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output name="sendObjectsWithFullStatusResponse">
            <soap:body use="literal" />
        </wsdl:output>
        <wsdl:fault name="NotificationServiceException">
            <soap:fault name="NotificationServiceException" use="literal" />
        </wsdl:fault>
    </wsdl:operation>
</wsdl:binding>
<wsdl:service name="NotificationServiceService">
    <wsdl:port binding="tns:NotificationServiceServiceSoapBinding" name="NotificationServicePort">
        <soap:address location="http://api.notificationmessaging.com/nsapi/services/NotificationService" />
    </wsdl:port>
</wsdl:service>
</wsdl:definitions>

预期输出:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:sendObjectResponse xmlns:n-
                                s2="http://api.service.nsapi.emailvision.com/">
            <return>SendRequest has been successfully saved!</return>
        </ns2:sendObjectResponse>
    </soap:Body>
    </soap:Envelope>

有人能提出实际问题是什么吗?

这个问题是来自我的请求还是来自服务器的响应?

共有2个答案

南门鸿哲
2023-03-14

您能在服务器端检查特定操作的实现情况吗。它必须发送wsdl作为响应,而不是您想要的响应。您还可以检查一次soap操作,这可能是由于错误的soap操作服务器通过向您发送wsdl来过滤您的请求,尽管我在您的wsdl中没有看到任何soap操作。

我已经在soapui中尝试了这个wsdl,我从中得到了正确的响应。虽然不成功。

查询随机数:4A776E3602000078与通知随机数:{1}不匹配!!!查询随机数:4A776E3602000078与通知随机数:{1}不匹配!!!

勾炳
2023-03-14

是否有具体的理由添加?wsdl到您的endpoint地址?来自服务器的响应(http://api.notificationmessaging.com/NMSOAP/NotificationService)不是你所期望的,但绝对不是WSLD

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:sendObjectsWithFullStatusResponse xmlns:ns2="http://api.service.nsapi.emailvision.com/">
<return>
<element responseStatus="failed" email="jblum@flowerpowershop.biz">
<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://www.w3.org/2001/XMLSchema" xsi:type="ns4:string">
Query random: 4A776E3602000078 doesnt match with notification random: {1} !!!
</result>
</element>
<element responseStatus="failed" email="dcoulon@flowerpowershop.biz">
<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://www.w3.org/2001/XMLSchema" xsi:type="ns4:string">
Query random: 4A776E3602000078 doesnt match with notification random: {1} !!!
</result>
</element>
</return>
</ns2:sendObjectsWithFullStatusResponse>
</soap:Body>
</soap:Envelope>
 类似资料:
  • 我已经用soap请求启动了一个新项目,我遵循了一些关于它的教程,但它并没有像它应该做的那样好。 我将这部分代码用于请求: 它给了我这个错误: SoapFault异常:[HTTP]不支持的媒体类型堆栈跟踪: 所有参数的类型都可以根据我得到的留档。和php部分似乎可以对我和我找到的所有教程。 我想知道这是否是头部问题或类似的问题。 WSDL在[这里](https://smarteye.ariadnex

  • Xml字符串没有以Xml格式打印。我正在创建动态soap信封,所以我可能无法为信封创建模型类,我提到了这一点,但他正在使用模态类创建soap信封,我想传递原始字符串xml,有什么方法可以传递原始xml字符串到改型体。

  • 本文向大家介绍请你谈谈对SOAP、WSDL、UDDI的了解?相关面试题,主要包含被问及请你谈谈对SOAP、WSDL、UDDI的了解?时的应答技巧和注意事项,需要的朋友参考一下 考察点:协议&语言 参考回答: - SOAP:简单对象访问协议(Simple Object Access Protocol),是Web Service中交换数据的一种协议规范。 - WSDL:Web服务描述语言(Web Se

  • 我需要从wsdl(使用wsdl url)为一个操作创建SOAP请求xml。我从一个web服务调用得到一个响应,我需要从这个响应中获取一些值,并将其添加到另一个web服务Soap请求中,然后再次执行一个web服务调用。因此,为了向soap请求添加新值,我需要获得完整的soap请求xml。这就是为什么我问如何从WSDD获得soap请求xml。我不能使用SoapUI,因为它每次都是动态的,所以我需要编写

  • 我使用以下方法创建了web服务: 过滤器在XSD模式中定义如下: 对象筛选器看起来像这样: 我发出请求: 但是,当在我的应用程序中读取请求时,我看到属性值包含“[value:null]”,而不是“someValue”。属性类型和属性名称都可以。

  • 我需要从现有的WSDL文件为使用OCPP协议的系统创建一个中心系统(SOAP服务器)。(开放充电桩协议) 我已经成功地在非wsdl模式和wsdl模式下编写了测试SOAP服务器和客户机,但是当我尝试使用现有的wsdl时,我得到的只是一堆错误(这并不能告诉我太多) 可以在此处找到WSDL文件(中央系统和chargepoint。抱歉,无法发布更多链接..) 我已经修复了一些错误,但是不能越过这个。 我想