Sigma Php Ajax framework, Ajax Components, GUI Builder
February 11, 2012, 11:21:19 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: saveURL using asmx web service problem  (Read 416 times)
OKL
Jr. Member
**
Posts: 14


View Profile
« on: July 13, 2010, 09:06:06 AM »

I'm using asmx web service (ASP.NET) to save data.

In Options I use 'saveURL':
saveURL : 'http://localhost/SampleWS/SampleService.asmx/SaveNewSample'
My Web Service can read all the sent data OK, but return json object automatically wrapped in xml by webservie.

Sample of return from web service:
<?xml version="1.0" encoding="utf-8" ?>
  <string xmlns="http://www.mycompany/CAP/sampling/">{success : true,exception:''}</string>

 
You can see my problem here, the Json string is wrapped in Xml and using this web service in 'out of the box' way is not going to work.


1. Is there a way to modify recieved Response from WebService to extract proper json string? May be by using one of the Grid events that happens after Response came back.
I thought maybe 'saveResponseHandler' event will be usefull. But in it I need a way to modify Response object.

2. Is there a way to send a Save message using custom code? I can make my own ajax call and get proper response (converted to json). I just want to know how to plug this response back to Grid for proper work.

3. Any other suggestions?

Thanks,
OKL
Logged
OKL
Jr. Member
**
Posts: 14


View Profile
« Reply #1 on: July 29, 2010, 07:15:20 AM »

in grid options add this handler:
saveResponseHandler: function(response, requestParameter) {
            var jsonSaveResponse = GetNodeValue(response.text, 'string'); //this transforms WS response from xml to json string.
            response.text = jsonSaveResponse;
            return true;
         }

Where GetNodeValue is a function that parses xml and extracts 'string' node.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!