Git Product home page Git Product logo

angular-soap's People

Contributors

aleksmeshkov avatar andrewmcgivery avatar gpelaez avatar jlast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-soap's Issues

TypeError: e is null on Firefox

This lib works perfectly on Chrome but on firefox I get this error:

TypeError: e is null at angular-soap.js line 16 (the callback function)

Is there a way around that?

Empty field names in response

Help!
Running the code against my web service i have encountered several issues now:

  1. The end point differs from the WDSL URL and does not seem to be picked up
  2. My web service is not .NET based and the code struggles to return the element names. Data comes back, but all i get is "\n\t","\n"
    I'm no javascript expert and have spent days trying to debug this wit no success, any help would be appreciated!

Any problem with ipv6 apple review rejection

Someone is using it and with problems with apple review on ipv6. Can anyone confirm that this library is out of trouble or makes direct calls hardcode ip, checks connection with AFNetworking or similar?

wsdl is null

When I try to make a Soap call the console tells me that the wsdl is null. How can I fix that?

TypeError: wsdl is null soapclient.js:165:6

Code in controller:

        var base_url = "http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx";

        $scope.submit = function(){
            var data = {
                month: 12,
                year: 2016
            };
            $soap.post(base_url, "GetUpcomingMovies", data).then(function(response){;
                console.log("data", response);
            })
        }

Connection fail?

Besides the "then" as I can get the way when the connection fails?

Angular 2

Hi,

Are you planning to port this project to Angular 2?

response is empty

Hello, I have a problem, when I call the $soap.post method this returns a promise, but it always returns me empty and in the api call it always returns values, you know how I can solve this. Greetings, I look forward to your response, thank you very much.

Cannot read property 'getElementsByTagName' of null

Getting error on https://github.com/andrewmcgivery/angular-soap/blob/3.0/soapclient.js#L423

i am calling return "http://providerservice.fmcnetwork.net/MobileAppService.asmx?op=UserRegistration" like this

return $soap.post("http://providerservice.fmcnetwork.net/MobileAppService.asmx",
"UserRegistration", {
DeviceUUID: data.DeviceUUID, DevicePushID: data.DevicePushID
});

is it right way? if it is i am getting this error "Cannot read property 'getElementsByTagName' of null"

SharePoint 2010 Response is Not Handled

I am working with the SharePoint 2010 Copy Web service, specifically with a "POST" to the "CopyIntoItemsLocalResponse" method (but I suspect the rest behave the same way).

There are a few response scenarios that are not handled with the default client. First if the results come back from the service with an error then I simply get a "0" in the success handler. It's not obvious from the xml below but the Copy.asmx service returns http status 200 for these two errors.

Sample1

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <CopyIntoItemsLocalResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
            <CopyIntoItemsLocalResult>0</CopyIntoItemsLocalResult>
            <Results>
                <CopyResult ErrorCode="DestinationInvalid" ErrorMessage="Cannot create an item at the requested destination.  Verify that the folder exists and that you have permission to edit in it." DestinationUrl="http://server/sites/mysite/reportlist/thefile/file.xlsx" />
            </Results>
        </CopyIntoItemsLocalResponse>
    </soap:Body>
</soap:Envelope>

Sample 2

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <CopyIntoItemsLocalResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
            <CopyIntoItemsLocalResult>0</CopyIntoItemsLocalResult>
            <Results>
                <CopyResult ErrorCode="Unknown" ErrorMessage="Invalid URI: The format of the URI could not be determined." DestinationUrl="/sites/mysite/reportlist/foo.xlsx" />
            </Results>
        </CopyIntoItemsLocalResponse>
    </soap:Body>
</soap:Envelope>

Lastly, similarly with the success message I simply get the "0" and not the "results" node.
Sample 3

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <CopyIntoItemsLocalResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
            <CopyIntoItemsLocalResult>0</CopyIntoItemsLocalResult>
            <Results>
                <CopyResult ErrorCode="Success" DestinationUrl="http://server/sites/mysite/reportlist/foo.xlsx" />
            </Results>
        </CopyIntoItemsLocalResponse>
    </soap:Body>
</soap:Envelope>

Multiple items

When i make a call i am only getting one item. I can see the XHR request and i can see that there are multiple items.

SOAP call not working on Firefox

We use this lib on our app and it works perfect on chrome and IE, but cannot get firefox to load the wsdl. Have tried debugging thru it and cannot find what is causing the problem in FF. It gets to the following lines and the wsdl variable is null:

SOAPClient._sendSoapRequest = function (url, method, parameters, async, callback, wsdl)
{
// get namespace
var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ?

It appears to be related to the _loadWsdl function where the xmlHttp.readyState always comes back as 1 instead of the 4 the following is looking for:

SOAPClient._loadWsdl = function (url, method, parameters, async, callback)
{
// load from cache?
var wsdl = SOAPClient_cacheWsdl[url];
if (wsdl + "" != "" && wsdl + "" != "undefined")
{
return SOAPClient._sendSoapRequest(url, method, parameters, async, callback, wsdl);
}
// get wsdl
var xmlHttp = SOAPClient._getXmlHttp();
xmlHttp.open("GET", url + "?wsdl", async);
if (async)
{
xmlHttp.onreadystatechange = function ()
{
if (xmlHttp.readyState == 4)
{
SOAPClient._onLoadWsdl(url, method, parameters, async, callback, xmlHttp);
}
}
}
xmlHttp.send(null);
if (!async)
{
return SOAPClient._onLoadWsdl(url, method, parameters, async, callback, xmlHttp);
}
};

Any thoughts or ideas would be greatly appreciated.
Ed

Certificate Authentication

I need to make a SOAP call that asks for a private certificate. Is there a way for me to authenticate through a certificate rather than the username/password combination?

Getting the response Data

@andrewmcgivery Hi! I am using this solution and it is working pretty fine.

I only have an issue and it is retrieving what the web service ends up sending as a response. Although I can see on fiddler packet trace that I have recieved one, if I try to operate that response I end up getting an empty object.

Here is the response I get from the service:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <StartConsultaResponse xmlns="http://ABMA/ConsultarRiesgoStartWS.tws">
            <riesgo>
                <cuit_cuil>20-35273177-4</cuit_cuil>
                <plan>2</plan>
                <respuesta>true</respuesta>
                <mensajeCentral>No se encontraron riesgos significativos</mensajeCentral>
            </riesgo>
        </StartConsultaResponse>
    </soapenv:Body>
</soapenv:Envelope>

And this is how I use the factory method:

$scope.cargarSolicitud = function(){
        $scope.solicitudAEnviar.cuit_cuil = angular.copy($scope.riskData.cuit);
        $scope.solicitudAEnviar.planActual = angular.copy($scope.comboData.planAnterior.id);
        $scope.solicitudAEnviar.planSolicitado = angular.copy($scope.comboData.planSolicitado.id);

    }

    $scope.call = function(){

        webService.ConsultarRiesgo($scope.solicitudAEnviar).then(function(result){
            $window.alert("The user: "+result.riesgo.cuit_cuil+" received the following response: "+result.riesgo.mensajeCentral);
        });

    }; 

In the end, no window gets opened, and, in fact, if I do this:

$scope.call = function(){

        $scope.finalResult = webService.ConsultarRiesgo($scope.solicitudAEnviar);

    };

The final object is "{}". It looks like I get an object without any contents. Is there any mistake on how I am using it?

Thanks in advance!

Working on iOS but not on Android - resource: net::ERR_NAME_NOT_RESOLVED

Hi,

First of all, thanks for your work.
This is working fine on iOS and browser desktop, but it fails on Android.
On Android I have "Failed to load resource: net::ERR_NAME_NOT_RESOLVED" and after that "Uncaught TypeError: Cannot read property 'documentElement' of null"

The Android have all the permissions correctly setted, I'm able to call others webservices.
Any ideia how to solve?

Function run incorrectly when server does not response http status code or 404 code.

Hi,
My factory:
angular.module('apps').factory('test_factory', ['$soap',function($soap){
var url = "abcdef.gh"; // invalid url to test for a case that server is broken.
var act = "something";
var parms = {"a":"b"};
return{
test_nonresponse: function(parms){
return $soap.post(url,act ,parms ).then(function(response){
console.log("RESULT");
},function(response){
console.log("Unexpected result");
})
}
}
}
in controller:
test_factory.test_nonrespons(); => no result was returned.

Thanks in advance!

Add license information

Please could you add a license to this repository? From here:

Generally speaking, the absence of a license means that the default copyright laws apply. This means that you retain all rights to your source code and that nobody else may reproduce, distribute, or create derivative works from your work. This might not be what you intend.

If you intend on this library being utilised, particularly by business, then a license is necessary.

XML with list of objects issues

Suppose you have an xml in this form:

<elements>
    <element>1</element>
    <element>2</element>
    <element>3</element>
</elements>

but in the wsdl elements is not declared as an array but as an object. The code must convert it to an array, instead soapclient.js in _node2object function extract only an element. Can we solve this?

Differences in array return vs singular item

@andrewmcgivery right. So one thing I have discovered is that when returning a singular the soapclient puts the result inside the data.item property and when returning an array it's an array.

easier to explain with code.

   var $soap = this.$injector.get("$soap");
   $soap.post(endpoint, "method_name", {})
            .then(function (data) {
             if (typeof (data.item) !== "undefined") {
                // There's only 1 version!
                versions = [data.item];
            }
            else {
                versions = data;
            }

I'm not sure if it's better documenting this different in behaviour between array results and singular results or standardising the result in the angular-soap wrapper?

Eric.

NTLM

Andrew does the module support NTLM authentication ? I can't seem to get it working. I get 401 every time.

Complete example for angular.soap

I am pretty new to AngularJS. Could you please provide a complete example for using your angular.soap, i.e., HTML and all?

Thank you!
Jeff

Post soapAction with colon

I have to pass soapAction which includes colon.
In my case it must bee urn:getSubscriber, so that's why i have changed your var soapaction.

xmlHttp.open("POST", url, async);
var soapaction = "urn:" + method; //must be urn:getSubscriber
xmlHttp.setRequestHeader("SOAPAction", soapaction);
xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

When i do so my callback always crashes. If i try same action without colon everything works fine.

//Create Callback
        var soapCallback = function(e){
                    //Error Uncaught TypeError: Cannot read property 'constructor' of null
                    if(e.constructor.toString().indexOf("function Error()") != -1){
                        deferred.reject("An error has occurred.");
                    } else {
                        deferred.resolve(e);
                    }
                }
            SOAPClient.invoke(url, action, soapParams, true, soapCallback);
            return deferred.promise;
        },
        setCredentials: function(username, password){
            SOAPClient.username = username;
            SOAPClient.password = password;
        }

error: Uncaught TypeError: Cannot read property 'constructor' of null

I hope you can help. If you need any additional info. please let me know.

Regards

Document is null

When set the header Authorization (line 252) the SOAPClient returns TypeError: document is null on soapclient.js:423:5.

PS: I changed the SOAPClient.userName by SOAPClient.username on the lines 249 and 252 because SOAPClient.userName always is null, the real value of username is on SOAPClient.username.

I'm using 3.0 version.

Parameters not going to server.....

I add the parameters to my post but on the server I do not receive them...

.factory("testService", ['$soap',function($soap){

return {
    GetCategoriesUsedByApp: function(app_id){
        return $soap.post(base_url,"GetLoanAmounts", {msisdn: app_id});
    }
}

}])

on server I get msisdn = null

Please help

Sending Wrong xml Request Namespace Format

Angularjs SOAP is supppose to send the request xml in this format

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.webclient.transflow.dialect.com.gh"> <soapenv:Header/> <soapenv:Body> <ser:getTrans> <ser:dlimit>10</ser:dlimit> <ser:username>xxxx</ser:username> <ser:password>xxxx</ser:password> </ser:getTrans> </soapenv:Body>
But it is rather sending it in this format

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<soap:Body>
		<getTrans xmlns="http://services.webclient.transflow.dialect.com.gh">
		<username>xxxx</username>
		<password>xxxx</password>
		<dlimit>10</dlimit>
		</getTrans>
	</soap:Body>
</soap:Envelope>

I wil be glad if anyone can help me resolve this thank you..

Solved errors with JAVA Web Service

1:This code fixes the problem of null parameters

var sr = 
				"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
				"<soap:Envelope " +
				"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
				"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
				"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
				"<soap:Body>" +
				"<ns2:" + method + " xmlns:ns2=\"" + ns + "\">" +
				parameters.toXml() +
				"</ns2:" + method + "></soap:Body></soap:Envelope>";

2:received ws-i bp non-conformant unquoted soapaction http

xmlHttp.setRequestHeader("SOAPAction", "\"" + soapaction + "\"");

Error when soapCallback is null

Probable this

//Create Callback
var soapCallback = function(e){
    if(e.constructor.toString().indexOf("function Error()") != -1){
        deferred.reject("An error has occurred.");
    } else {
        deferred.resolve(e);
    }
}

should be changed to

//Create Callback
var soapCallback = function(e){
    if(e == null || e.constructor.toString().indexOf("function Error()") != -1){
        deferred.reject("An error has occurred.");
    } else {
        deferred.resolve(e);
    }
}

Best
George

CORS

He, I am attempting some cross-site SOAP services. The services work fine. I've been using them for years. The back-end is Java/Tomcat-8.0.9. I have spent many hours and I keep getting:

OPTIONS http://localhost:8084/Arahant/MainOps soapclient.js:190 SOAPClient._sendSoapRequestsoapclient.js:153 SOAPClient._onLoadWsdlsoapclient.js:142 xmlHttp.onreadystatechange
index.html:1 XMLHttpRequest cannot load http://localhost:8084/Arahant/MainOps. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:63342' is therefore not allowed access. The response had HTTP status code 403.
soapclient.js:331 Uncaught TypeError: Cannot read property 'getElementsByTagName' of nullsoapclient.js:331 SOAPClient._getElementsByTagNamesoapclient.js:198 SOAPClient._onSendSoapRequestsoapclient.js:187 xmlHttp.onreadystatechange

Tomcat's web.xml has the following:

<filter>
    <filter-name>CorsFilter</filter-name>
    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
    <init-param>
        <param-name>cors.allowed.headers</param-name>
        <param-value>Content-Type,X-Requested-With,Accept,Accept-Encoding,Accept-Language,Cache-Control,Connection,Host,Pragma,Origin,Referer,User-Agent,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
    </init-param>
    <init-param>
        <param-name>cors.exposed.headers</param-name>
        <param-value>Access-Control-Allow-Origin,Content-Length,Content-Type,Date,Server,Access-Control-Allow-Credentials</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>CorsFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

The JS code looks like this:

    $soap.post('http://localhost:8084/Arahant/MainOps', 'getLoginProperties').then(function(response) {
        var x = response;
        var y = x;
    });

I have no idea what else to do. If you could, I would sure appreciate it.

Thanks.

Blake McBride

how to set header in soap.post

Can you Please help me out how to set header while making soap.post cause im getting No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access.
my code is
angular.module('myAppApp')
.controller('MainCtrl', function ($scope, $http, socket,soapService) {
// {console.log(data)})
$scope.SOAPAction="http://radixx.com/WSRadixx/RadixxAdmin/EncryptLoginInfo";
$scope.config={
'Content-Type': 'text/xml;charset=utf-8',
'Content-Length': 'length',
'Access-Control-Allow-Origin': '*',
}
soapService.getData($scope.SOAPAction,$scope.config).then(function(response){
console.log("soapService response",response)
$scope.response = response;
});
})

Need Tests

Would be nice to have a set of tests for this library as functionality expands from the original port.

Help needed with Authentication

Hi,
I am trying to access list of busstops from this address
http://st.atb.no/infotransit/userservices.asmx?WSDL
this needs authentication to access.

I follwed the "Example 5: Set Connection Credentials" procedure and still no success.

It throws following error:
"
XHR finished loading: GET "http://st.atb.no/infotransit/userservices.asmx?wsdl".

POST http://st.atb.no/infotransit/userservices.asmx 500 (Internal Server Error)

SOAPClient._sendSoapRequest @ soapclient.js:190
SOAPClient._onLoadWsdl @ soapclient.js:153
xmlHttp.onreadystatechange @ soapclient.js:142

XHR finished loading: POST "http://st.atb.no/infotransit/userservices.asmx".
"

Implementation(check app.js): http://plnkr.co/edit/Ty9Piz97n6UZNExHoFpJ

user access details are masked in the plunker implemenatation. I can share through personal email, if provided.

Thanks in advance,

--Sri

How to pass session id with SOAP request

Hi,
I might be wrong with this one. But Magent api requires to send session id for each call. It's equivalant PHP code is this:

$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');

$newCustomer = array(
'firstname' => 'First',
'lastname' => 'Last',
'email' => '[email protected]',
//for my version of magento (1.3.2.4) you SHOULD NOT
// hash the password, as in:
// 'password_hash' => 'password'
'password_hash' => md5('password'),
// password hash can be either regular or salted md5:
// $hash = md5($password);
// $hash = md5($salt.$password).':'.$salt;
// both variants are valid
'store_id' => 0,
'website_id' => 0
);

$newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));

As you can see, sessionId is being passed along with method and data. How can we do this with JS API, or am I wrong in thinking like this.

Right now login to API is working for me, from which I can retrieve session id but it is giving error when I call above method.

Any ideas?

Rare Bug :S

hello there! I've started using angular-soap, but I got a rare bug, i call the service with parameters, but my api says that those parameters are null, even when i hardcode them in my factory,

Add timeout

Add a parameter where you can set the timeout of the request

Sending authorisation header in the soap request

Hi ,
How can I send header elements in the soap request call using this model. I need to send these parameters in my soap call
Authorization,
SOAPAction:"urn:processDocument",
"Content-Type": 'application/x-www-form-urlencoded'

Post Array

I need to post an items array to my WS:

array(
"name" => "field_name",
"value" => "value_of_field_to_save"
),

But I don't know how to achieve it with angular-soap (Its working fine for the app for take info but not to push it because that).

Any guideline?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.