i get below response from the server. and i want {“MRRESP”: … “0”}}
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">{"MRRESP":{"RESPTYPE":"LOGIN","STCODE":"0","STMSG":"Success","MEMBERID":"2"}}</string>
i get below response from the server. and i want {“MRRESP”: … “0”}}
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">{"MRRESP":{"RESPTYPE":"LOGIN","STCODE":"0","STMSG":"Success","MEMBERID":"2"}}</string>
thanx richardmarais…i tried your suggestion…but i getting below error
my response is below
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">{"MRRESP":{"RESPTYPE":"LOGIN","STCODE":"0","STMSG":"Success","MEMBERID":"2"}}</string>
Your server is broken. It says it’s returning XML, but it isn’t. Fix it to return JSON.
i didn’t understand what you want to say
i tried to remove below line from server side but it add automatically i don’t know why?
“<?xml version="1.0" encoding="utf-8"?>
”
so if u have any technique that get response as string and i cut the string and then i convert it to json,please share with me
yeah then you have soap webservices and not a json api.
You can not simply remove the xml-line… if the server is not configured/programmed to return xml-data, it will return it as xml markup and not json
That is the wrong way to go about it. You need to fix the server. It is returning ill-formed documents. If you want it to return XML, have it return XML and then parse XML in the client. If you want it to return JSON, have it return JSON and then parse JSON in the client. What it is currently serving is garbage. Any attempt to kludge it on the client side is equivalent to compensating for an ankle injury by walking weirdly and ruining your knee. Don’t do that.
In some case i have soap is used so i also want how to handle soap response in ionic 2??
You can use another module to handle a soap response
Hello @mhartington,
I just added angular2-soap by using npm install autopulous-angular2-soap.
Now it will show in my node_module directory.
Then i use it like import { SoapService } from “autopulous-angular2-soap/soap.service”;
after that i used in my code.
When i run ionic serve then it will give me error
bundle failed: ‘SoapService’ is not exported by node_modules/autopulous-angular2-soap/soap.service.js
(imported by src/pages/user-login/user-login.ts). For help fixing this error see https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module .
how i can resolve this issue?
Can u give me an example, how to integrate in my ionic v2 project. Is there any method for how to use it with ionic v2. Thank you.