Click here to Skip to main content
15,868,016 members

Comments by sairanga (Top 4 by date)

sairanga 11-Sep-12 6:19am View    
Deleted
How to create json web services using java platform?
sairanga 11-Sep-12 1:06am View    
Hey this was my code i am getting no response it was showing white screen.......
sairanga 11-Sep-12 1:03am View    
//This is my server side code in java web services
public class Demoapp {

//web method getname
public String getname(){
String s="HI this is First";

return s;
}

}

//This was my client side code using javascript
var settings = {requestType:"soap1.1",
error:function(XMLHttpRequest, textStatus, errorThrown){
throw XMLHttpRequest.responseText;
}};
var oBuffer = new Array();
settings.requestType = "soap1.1";
settings.methodType = "POST";
settings.contentType = "text/xml";
settings.url = "http://192.168.1.5:8080/Demoweb/services/Demoapp?wsdl";
settings.dataType = "text/xml";
settings.nameSpace = "http://Demoweb/";
settings.methodName = "getname";

oBuffer.push('<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/">');
oBuffer.push("<soap:body>");
oBuffer.push('<getname xmlns="http://Demoweb/">');
oBuffer.push('<vc>getname');
oBuffer.push("");
oBuffer.push("");
oBuffer.push("");
settings.requestData = oBuffer.join("");
alert("requestData:" + settings.requestData);
$.ajax({
type: settings.methodType,
cache: false,
url: settings.url,
data: settings.requestData,
contentType: settings.contentType,
dataType: settings.dataType,
error: function(status){ alert("An error occurred in processing your request");},
success: function(data, testStatus){
alert('data = ' + data);
$('#testp').html(data);
},
beforeSend: function(XMLHttpRequest){
if (settings.requestType == "soap1.1" || settings.requestType== "soap1.2")
XMLHttpRequest.setRequestHeader("SOAPAction",settings.nameSpace + settings.methodName);
XMLHttpRequest.setRequestHeader("Content-Length",settings.requestData.length);
XMLHttpRequest.setRequestHeader("Connection", "close"); } });
sairanga 10-Sep-12 14:02pm View    
Sir,
Thank you for reply,
I have already tried these examples.But i didn't get any response from client side even it was not hitting the server. I am using java web services on server side and i am trying to call those methods and url from client side using either java script(or)Jquery.Here the example contains asp.net web services.
Is it work for me.I am new to this platform please suggest me how to do this..