微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

通过angular中的ngx-soap调用soap服务时找不到方法错误

如何解决通过angular中的ngx-soap调用soap服务时找不到方法错误

我正在使用ngx-soap消耗我的soap Web服务。这段代码对于.net托管的soap服务非常有效,但是对于由Java开发并由weblogic应用程序服务器托管的其他Web服务,找不到throws方法例外。这是用于测试的简单wsdl文件内容,其中包含操作“ sayHello”,但在运行时抛出“方法sayHello未找到”异常:

  <!--  Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.6hudson-86  svn-revision#12773.  -->
<!--  Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.6hudson-86  svn-revision#12773.  -->
<deFinitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/Metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.tosan.com/thirdParty" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.tosan.com/thirdParty" name="AngularserviceTest">
<types>
<xsd:schema>
<xsd:import namespace="http://www.tosan.com/thirdParty" schemaLocation="http://192.168.7.177:3131/AngularserviceTest/AngularserviceTest?xsd=1"/>
</xsd:schema>
</types>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="AngularserviceTest">
<operation name="sayHello">
<input wsam:Action="http://www.tosan.com/thirdParty/AngularserviceTest/sayHelloRequest" message="tns:sayHello"/>
<output wsam:Action="http://www.tosan.com/thirdParty/AngularserviceTest/sayHelloResponse" message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="AngularserviceTestPortBinding" type="tns:AngularserviceTest">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="AngularserviceTest">
<port name="AngularserviceTestPort" binding="tns:AngularserviceTestPortBinding">
<soap:address location="http://192.168.7.177:3131/AngularserviceTest/AngularserviceTest"/>
</port>
</service>
</deFinitions>

如下面的浏览器控制台屏幕截图所示,客户端已成功初始化,未检测到任何操作,因此在调用方法“ sayHello”时遇到未找到的方法

这是我使用该服务的代码块:

const promise =
      this.soap.createClient('http://ip:port/AngularserviceTest/AngularserviceTest?WSDL')
        .then(client => {
          this.client = client;
          console.log(client);
        },err => console.log(err));


    from(promise).subscribe(client => {
      return this.client.call('sayHello','')
        .subscribe(res => {
          this.xmlResponse = res.responseBody;
          this.message = res.result.AddResult;
          console.log(res.result);
      })
     });

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。