错误使用soapclient.js和angular.soap.js从angularjs调用WSDL服务

时间:2016-05-31 04:44:49

标签: angularjs web-services soap wsdl

我想从我的角度应用程序中调用wsdl服务(由dataflux数据管理工作室创建)。

我已经提到了这个帖子 1)AngularJS - SOAP Service Integration With AngularJS Model 2)Simplest SOAP example 3)How to consume a SOAP WebService with AngularJS?

我正在使用soapclient.js和angular.soap.js

它给出了这个错误:

Uncaught TypeError: Cannot read property 'constructor' of null
soapCallback @ angular.soap.js:16
SOAPClient._onSendSoapRequest @ soapclient.js:214
xmlHttp.onreadystatechange @ soapclient.js:187

我在控制器中的代码:

$scope.getData = function(){
soapService.DMService().then(function(response){ $scope.response = response; }); }

在app.js中,

 app.factory("soapService", ['$soap',function($soap){
   var base_url =              "http://myserver:9000/WSDL_Web_Service/service__DashBoard.WSDL";

    return {
        DMService: function(){          
            return $soap.post(base_url,"procsvc_service__DashBoard.djf");
        }
    }
    }]);   

我的wsdl服务:service__Dashboard.WSDL

`

 <?xml version="1.0"?>
    <definitions name="DMService"
            targetNamespace="http://archserver.wsdl.dataflux.com"
            xmlns:tns="http://archserver.wsdl.dataflux.com"
            xmlns:archxsd="archserver.xsd.dataflux.com"

     xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
     xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
     xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
     xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
     xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
     xmlns="http://schemas.xmlsoap.org/wsdl/">

    <types>
     <schema
            targetNamespace="archserver.xsd.dataflux.com"
            xmlns:tns="archserver.xsd.dataflux.com"
            xmlns="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="unqualified"
            attributeFormDefault="unqualified">

      <complexType name="request">
        <sequence>
       </sequence>
      </complexType>
      <element name="procsvc_service__DashBoard.djf_in" type="tns:request"/>

      <complexType name="response">
        <sequence>
        <element name="result" type="xsd:string" minOccurs="0" maxOccurs="1"/>
       </sequence>
      </complexType>
      <element name="procsvc_service__DashBoard.djf_out" type="tns:response"/>

     </schema>
    </types>


    <message name="procsvc_service__DashBoard.djf_in">
     <part name="body" element="archxsd:procsvc_service__DashBoard.djf_in"/>
    </message>
    <message name="procsvc_service__DashBoard.djf_out">
     <part name="body" element="archxsd:procsvc_service__DashBoard.djf_out"/>
    </message>


    <portType name="DataManagementServicePortType">
     <operation name="procsvc_service__DashBoard.djf_in">
      <documentation></documentation>
      <input message="tns:procsvc_service__DashBoard.djf_in"/>
      <output message="tns:procsvc_service__DashBoard.djf_out"/>
     </operation>
    </portType>


    <binding name="DataManagementService" type="tns:DataManagementServicePortType">
     <SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
     <operation name="procsvc_service__DashBoard.djf_in">
      <SOAP:operation soapAction="service__DashBoard.djf*1*57195B25CE0B6D37"/>
      <input>
       <SOAP:body use="literal"/>
      </input>
      <output>
       <SOAP:body use="literal"/>
      </output>
     </operation>
    </binding>

    <service name="DMService">
     <documentation>Data Management Server</documentation>
     <port name="DMService" binding="tns:DataManagementService">
      <SOAP:address location="http://someserver:21000"/>
     </port>
    </service>
    </definitions>   `

soapclient.js中的更改(在第201行的方法SOAPClient._onSendSoapRequest中):

var nd = SOAPClient._getElementsByTagName(req.responseXML, method + **"_in"**);
    if(nd.length == 0)
        nd = SOAPClient._getElementsByTagName(req.responseXML, "return");

我觉得,我可能会以错误的方式调用wsdl方法,但却无法弄清楚它应该如何。如果有人能够更多地了解它应该如何完成......那就太棒了

...谢谢

0 个答案:

没有答案