Phonegap Consuming Web Service PHP -
the next problem try consume web service. try plugins , pure xml result still "null".
the code this.
function soap(imei,clave) { var divtobeworkedon = "#res"; var webserviceurl = ''; var parameters = '<?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> \ <registra_imei> \ <request> \ <imei>'+imei+'</imei> \ <clave>'+clave+'</clave> \ </request> \ </registra_imei> \ </soap:body> \ </soap:envelope>'; $.ajax({ type: "post", url: webserviceurl, data: parameters, contenttype: "text/xml; charset=\"utf-8\"", datatype: "xml", success: function(msg) { alert("funciono "+msg); }, error: function(e){ alert("error"); } }); }
the web services simple soap php. need send variables , response code (1, 2 or 3).
the requeriment event "registra_imei" this:
name: registra_imei binding: soapbinding endpoint: soapaction: urn:soapwsdl#registra_imei style: rpc input: use: encoded namespace: urn:soapwsdl encodingstyle: http://schemas.xmlsoap.org/soap/encoding/ message: registra_imeirequest parts: imei: xsd:string clave: xsd:string output: use: encoded namespace: urn:soapwsdl encodingstyle: http://schemas.xmlsoap.org/soap/encoding/ message: registra_imeiresponse parts: return: xsd:int namespace: urn:soapwsdl transport: http://schemas.xmlsoap.org/soap/http documentation: registra imei
my comment long post comment area.
so, using soapui
simulated call wsdl
, got raw
response:
http/1.1 200 ok date: tue, 14 apr 2015 19:44:24 gmt server: litespeed x-powered-by: php/5.4.39 access-control-allow-origin: * access-control-allow-credentials: true access-control-allow-methods: put, get, post, delete, options access-control-allow-headers: origin, x-requested-with, content-type, accept set-cookie: phpsessid=870fgce5tm1ep8get75066i491; path=/ expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache content-type: text/html; charset=utf-8 content-length: 0
this soap
request:
<soapenv:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:soapwsdl"> <soapenv:header/> <soapenv:body> <urn:registra_imei soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"> <imei xsi:type="xsd:string">65656565</imei> <clave xsi:type="xsd:string">123</clave> </urn:registra_imei> </soapenv:body> </soapenv:envelope>
raw
request:
post http://soap.movilaccesscloud.cl/serversoap.php/ http/1.1 accept-encoding: gzip,deflate content-type: text/xml;charset=utf-8 soapaction: "urn:soapwsdl#registra_imei" content-length: 508 host: soap.movilaccesscloud.cl proxy-connection: keep-alive user-agent: apache-httpclient/4.1.1 (java 1.5)
apparently, error in back-end of webservice. check php code, if possible please share part of code.
i repeat, intention put comment in proper area, can see it´s long.
:)
Comments
Post a Comment