Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Highlighted
Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Help to call one method from web service

Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Help to call one method from web service

Hey ravi,

 

Not sure if this is for a BB app or not? But this code should get you on your way. It's important that you understand the data you are trying to get from the WSDL. More information can be seen here:

 

http://www.w3.org/TR/wsdl

 

function onError(requestdatastatus{
    console.log(status);
}

function onSuccess(datastatus{
    console.log(data);
}

function loadData({

    var soapMessage '<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlnsSmiley FrustratedOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://wsendpoints.bbrailapps.firstgroup.com" xmlns:intf="http://wsendpoints.bbrailapps.firstgroup.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Body><intf:getVersion xmlns:intf="http://wsendpoints.bbrailapps.firstgroup.com"></intf:getVersion></SOAP-ENV:Body></SOAP-ENV:Envelope>';

    $.ajax({
        url"http://railapps.firstgroup.com/FirstGroupRailApps/services/RailAppsCAWS?wsdl",
        type"POST",
        dataType"xml",
        datasoapMessage,
        processDatafalse,
        contentType"text/xml; charset=\"utf-8\"",
        successonSuccess,
        erroronError
    });
}

loadData();

@erikjohnzon
erjohnson@blackberry.com
Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: Help to call one method from web service

Thanks

Sir for reply

 

actually i am getting all xml .

 

But expected result should be after call get version : 1.3

 

can you help me getting this

 

Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: Help to call one method from web service

After calling getversion method 

Expected result should be : 1.3 or 1.4

Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Help to call one method from web service

The expected result from a SOAP webservice is always XML. This is the output I get below:

 

<script/>
<soapenv:Body>
<getVersionResponse xmlns="http://wsendpoints.bbrailapps.firstgroup.com">
<getVersionReturn>1.3</getVersionReturn>
</getVersionResponse>
</soapenv:Body>
</soapenv:Envelope>
@erikjohnzon
erjohnson@blackberry.com
Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: Help to call one method from web service

<!DOCTYPE html> 
<html> 
    <head> 
        <meta charset="utf-8"> 
        <title>Hello World</title> 
  <script src="jquery.min.js" type="text/javascript"></script> 
  	<script>
function onError(request, data, status) {
    console.log(status);
}

function onSuccess(data, status) {
    console.log(data);
}

function loadData() {

    var soapMessage = '<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlnsOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://wsendpoints.bbrailapps.firstgroup.com" xmlns:intf="http://wsendpoints.bbrailapps.firstgroup.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Body><intf:getVersion xmlns:intf="http://wsendpoints.bbrailapps.firstgroup.com"></intf:getVersion></SOAP-ENV:Body></SOAP-ENV:Envelope>';

    $.ajax({
        url: "http://railapps.firstgroup.com/FirstGroupRailApps/services/RailAppsCAWS?wsdl",
        type: "POST",
        dataType: "xml",
        data: soapMessage,
        processData: false,
        contentType: "text/xml; charset=\"utf-8\"",
        success: onSuccess,
        error: onError
    });
}
		
		</script>
 
    </head> 
    <body onload="loadData();"></body> 
</html>

 i used this code and getting error

 

  1. POST http://railapps.firstgroup.com/FirstGroupRailApps/services/RailAppsCAWS?wsdl 500 (Internal Server Error) jquery.min.js:4
    1. f.support.ajax.f.ajaxTransport.sendjquery.min.js:4
    2. f.extend.ajaxjquery.min.js:4
    3. loadDatatest.html:20
    4. onload

 

    1.  
       
      But when i change type: "GET", i get whole xml .having none of value..Smiley Sad
       
       

 

Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: Help to call one method from web service

Your output is correct but i am not get this out put please help

Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: Help to call one method from web service

Error display internal server error..

Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: Help to call one method from web service

Please help , to solve this issue