I have an asmx web service and a test console app. I have added web service reference to the console app and calling it like this
Employee.Employee e = new TestService.Employee.Employee();
e.SomeMethod();
On every web service call there is a validation check which looks like this
private bool IsUserNameTokenPresent()
{
//Get current SOAP context
SoapContext ctxt = RequestSoapContext.Current;
UsernameToken user = null;
if (ctxt == null)
{
//This request is using a different protocol other than SOAP.
return false;
}
//Iterate through all Security tokens
foreach(SecurityToken tok in ctxt.Security.Tokens)
{
if (tok is UsernameToken)
{
user = (UsernameToken)tok;
}
}
if (user == null)
return false;
return true;
}
Question: How do I pass the Security Token so that I can test this service. Its always null.
Finally found the answer for this. I had to create my own SOAP header manually and pass it with the request. Here is some code. I had to create Nonce dynamically for every call, I will post it here if someone wants the code for that.
XmlDocument doc = new XmlDocument();
doc.InnerXml = #"<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope
xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'>
<soap:Header>
<wsse:Security soap:mustUnderstand='1'>
<wsse:UsernameToken wsu:Id='uuid_faf0159a-6b13-4139-a6da-cb7b4100c10c'>
<wsse:Username>UserID</wsse:Username>
<wsse:Password>Pass</wsse:Password>
<wsse:Nonce>" + nonce + #"</wsse:Nonce>
<wsu:Created>" + date + #"</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<FindBySelfId>
<specification>
<LastName>" + lastname + #"</LastName>
<FirstName>" + firstname + #"</FirstName>
<DateOfBirth>" + dob + #"</DateOfBirth>
<HomeZipCode>" + zip + #"</HomeZipCode>
<SSN4>" + ssn + #"</SSN4>
</specification>
</FindBySelfId >
</soap:Body>
</soap:Envelope>";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://localhost/Employee/employee.asmx");
req.Headers.Add("SOAPAction", "https://<Namespace here>");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestStream();
doc.Save(stm);
stm.Close();
Related
I have an existing jar which sends web-service request from one of our application server to another. Below is the code for sending the request
public IUsbMessage executeOutboundRequest(IUsbMessage paramIUsbMessage)
{
IUsbMessage localIUsbMessage = UsbMessageFactory.createUbusMessage();
try
{
LogManager.logDebug("ServiceProvider:- Enter executeOutboundRequest");
Object[] arrayOfObject = (Object[])paramIUsbMessage.getPayload();
NVPVO localNVPVO = (NVPVO)arrayOfObject[1];
String str1 = (String)localNVPVO.getHashmap().get("endPointUrl");
String str2 = (String)localNVPVO.getHashmap().get("respTag");
String str3 = (String)localNVPVO.getHashmap().get("body");
str3 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><FIXML xsi:schemaLocation=\"http://www.oracle.com/fixml AcctInq.xsd\" xmlns=\"http://www.oracle.com/fixml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + str3.trim();
LogManager.logDebug("ServiceProvider:- RequestXMLMsg" + str3);
MessageFactory localMessageFactory = MessageFactory.newInstance();
SOAPMessage localSOAPMessage1 = localMessageFactory.createMessage();
SOAPFactory localSOAPFactory = SOAPFactory.newInstance();
SOAPBody localSOAPBody = localSOAPMessage1.getSOAPBody();
SOAPElement localSOAPElement1 = localSOAPBody.addChildElement(localSOAPFactory.createName("executeService"));
SOAPElement localSOAPElement2 = localSOAPElement1.addChildElement(localSOAPFactory.createName("arg_0_0"));
localSOAPElement2.addTextNode(str3);
localSOAPMessage1.saveChanges();
localSOAPMessage1.writeTo(System.out);
SOAPConnectionFactory localSOAPConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection localSOAPConnection = localSOAPConnectionFactory.createConnection();
LogManager.logDebug("ServiceProvider:- endPointUrl" + str1);
LogManager.logDebug("ServiceProvider:- respTag" + str2);
URL localURL = new URL(str1);
SOAPMessage localSOAPMessage2 = localSOAPConnection.call(localSOAPMessage1, localURL);
DocumentBuilderFactory localDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder localDocumentBuilder = localDocumentBuilderFactory.newDocumentBuilder();
Document localDocument = localDocumentBuilder.newDocument();
Element localElement1 = null;
Element localElement2 = null;
Text localText = null;
Element localElement3 = null;
Iterator localIterator = localSOAPMessage2.getSOAPBody().getChildElements();
Object localObject2;
Object localObject3;
while (localIterator.hasNext())
{
localObject1 = (SOAPElement)localIterator.next();
localElement1 = localDocument.createElement(((SOAPElement)localObject1).getNodeName());
localObject2 = ((SOAPElement)localObject1).getAttributes();
Object localObject4;
if (((NamedNodeMap)localObject2).getLength() > 0) {
for (int i = 0; i < ((NamedNodeMap)localObject2).getLength(); i++)
{
localObject4 = ((NamedNodeMap)localObject2).item(i);
localElement1.setAttribute(((Node)localObject4).getNodeName(), ((Node)localObject4).getNodeValue());
}
}
localElement3 = localElement1;
localObject3 = ((SOAPElement)localObject1).getChildElements();
while (((Iterator)localObject3).hasNext())
{
localObject4 = (SOAPElement)((Iterator)localObject3).next();
localElement1 = localDocument.createElement(((SOAPElement)localObject4).getNodeName());
NamedNodeMap localNamedNodeMap = ((SOAPElement)localObject1).getAttributes();
if (localNamedNodeMap.getLength() > 0) {
for (int j = 0; j < localNamedNodeMap.getLength(); j++)
{
Node localNode = localNamedNodeMap.item(j);
localElement1.setAttribute(localNode.getNodeName(), localNode.getNodeValue());
}
}
localElement2 = localElement1;
localText = localDocument.createTextNode(((SOAPElement)localObject4).getValue());
localElement2.appendChild(localText);
localElement3.appendChild(localElement2);
}
The data which is being passed to the class file is as below containing the request XML and other details
respTag=AcctInqRs,
body=<Header>
<RequestHeader>
<MessageKey>
<RequestUUID>Req_159538426</RequestUUID>
<ServiceRequestId>AcctInq</ServiceRequestId>
<ServiceRequestVersion>10.2</ServiceRequestVersion>
<ChannelId>OR</ChannelId>
<LanguageId></LanguageId>
</MessageKey>
<RequestMessageInfo>
<BankId>54</BankId>
<TimeZone></TimeZone>
<EntityId></EntityId>
<EntityType></EntityType>
<ArmCorrelationId></ArmCorrelationId>
<MessageDateTime>2020-02-23T14:27:22.627</MessageDateTime>
</RequestMessageInfo>
<Security>
<Token>
<PasswordToken>
<UserId></UserId>
<Password></Password>
</PasswordToken>
</Token>
<FICertToken></FICertToken>
<RealUserLoginSessionId></RealUserLoginSessionId>
<RealUser></RealUser>
<RealUserPwd></RealUserPwd>
<SSOTransferToken></SSOTransferToken>
</Security>
</RequestHeader>
</Header>
<Body>
<AcctInqRequest>
<AcctInqRq>
<AcctId>
<AcctId>1101614</AcctId>
</AcctId>
</AcctInqRq>
</AcctInqRequest>
</Body>
</FIXML>,
reqhdr.requestuuid=FINCORE240716215711,
endPointUrl=https://ORPREPROD.domain.com:20322/fiwebservice/FIWebService,
reqhdr.messagedatetime=2020-04-21T21:57:11.000,
reqhdr.servicerequestversion=10.2,
reqhdr.origchannelid=COR,
reqhdr.bankid=54,
reqhdr.servicerequestid=AcctInq
Now the issue is that the request is being sent from server A to server B. Once the request reaches server B it is throwing error "HTTP/1.1 500 Internal Server Error" and the below xml is seen in the logs
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<env:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>**Failed to get operation name from incoming request**</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
On both the servers our application is deployed on Weblogic and the above errors are from weblogic logs. Can anyone please help me to determine the exact cause of this error, I am totally stuck and clueless about what to do.
The same request XML when sent through SOAP UI works perfectly.
The below request XML works in SOAPUI
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://webservice.fiusb.ci.ibm.com/">
<soapenv:Header/>
<soapenv:Body>
<web:executeService>
<arg_0_0><![CDATA[<FIXML xsi:schemaLocation="http://www.finacle.com/fixml AcctInq.xsd" xmlns="http://www.finacle.com/fixml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Header><RequestHeader><MessageKey><RequestUUID>Req_158495384262711</RequestUUID><ServiceRequestId>AcctInq</ServiceRequestId><ServiceRequestVersion>10.2</ServiceRequestVersion><ChannelId>COR</ChannelId><LanguageId></LanguageId></MessageKey><RequestMessageInfo><BankId>54</BankId><TimeZone></TimeZone><EntityId></EntityId><EntityType></EntityType><ArmCorrelationId></ArmCorrelationId><MessageDateTime>2020-02-23T14:27:22.627</MessageDateTime></RequestMessageInfo><Security><Token><PasswordToken><UserId></UserId><Password></Password></PasswordToken></Token><FICertToken></FICertToken><RealUserLoginSessionId></RealUserLoginSessionId><RealUser></RealUser><RealUserPwd></RealUserPwd><SSOTransferToken></SSOTransferToken></Security></RequestHeader></Header><Body><AcctInqRequest><AcctInqRq><AcctId><AcctId>1100161916154</AcctId></AcctId></AcctInqRq></AcctInqRequest></Body></FIXML>
]]></arg_0_0>
</web:executeService>
</soapenv:Body>
</soapenv:Envelope>
The below XML throws the same error "Failed to get operation name from incoming request"
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://webservice.fiusb.ci.ibm.com">
<soapenv:Header/>
<soapenv:Body>
<web:executeService>
<arg_0_0><![CDATA[<FIXML xsi:schemaLocation="http://www.finacle.com/fixml AcctInq.xsd" xmlns="http://www.finacle.com/fixml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Header><RequestHeader><MessageKey><RequestUUID>Req_158495384262711</RequestUUID><ServiceRequestId>AcctInq</ServiceRequestId><ServiceRequestVersion>10.2</ServiceRequestVersion><ChannelId>COR</ChannelId><LanguageId></LanguageId></MessageKey><RequestMessageInfo><BankId>54</BankId><TimeZone></TimeZone><EntityId></EntityId><EntityType></EntityType><ArmCorrelationId></ArmCorrelationId><MessageDateTime>2020-02-23T14:27:22.627</MessageDateTime></RequestMessageInfo><Security><Token><PasswordToken><UserId></UserId><Password></Password></PasswordToken></Token><FICertToken></FICertToken><RealUserLoginSessionId></RealUserLoginSessionId><RealUser></RealUser><RealUserPwd></RealUserPwd><SSOTransferToken></SSOTransferToken></Security></RequestHeader></Header><Body><AcctInqRequest><AcctInqRq><AcctId><AcctId>1100161916154</AcctId></AcctId></AcctInqRq></AcctInqRequest></Body></FIXML>
]]></arg_0_0>
</web:executeService>
</soapenv:Body>
</soapenv:Envelope>
Notice the forward slash(/) at the end of namespace. If the slash is not there in the namespace it throws the error in SOAP UI.
Please help me to understand how can I change namespace in my java code
Here is the structure of my SOAP webservice which I need to get the TxRefNum:
<?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:tem="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body>
<tem:MakeCreditCardPayment>
<tem:objCreditCardBookingPaymentRow>
<tem:ProfessionalUserMappingStudioID>18</tem:ProfessionalUserMappingStudioID>
<tem:ConsumerUserMappingStudioID>5</tem:ConsumerUserMappingStudioID>
<tem:Cost>5</tem:Cost>
<tem:CardNumber>4111111111111111</tem:CardNumber>
<tem:CardHolderName>Shyam</tem:CardHolderName>
<tem:ExpirationDate>042020</tem:ExpirationDate>
<tem:CVV>123</tem:CVV>
<tem:ProfessionalSessionID>320</tem:ProfessionalSessionID>
<tem:TxRefNum></tem:TxRefNum>
</tem:objCreditCardBookingPaymentRow>
</tem:MakeCreditCardPayment>
</soap:Body>
</soap:Envelope>
I am using ksoap2 library to parse the following data, but am unable to find a proper solution to it. Here's what I am doing:
final String NAMESPACE = "http://tempuri.org/";
final String URL = NewURLs.BASE_URL + "api/PaymentService.asmx";
final String SOAP_ACTION = "http://tempuri.org/MakeCreditCardPayment";
final String METHOD_NAME = "MakeCreditCardPayment";
final String INNER_METHOD_NAME = "tem:objCreditCardBookingPaymentRow";
// the above parameter can be taken from the users web service
// (?WSDL)
// url
SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
SoapObject innerRequest = new SoapObject(NAMESPACE,INNER_METHOD_NAME);
innerRequest.addProperty("tem:ProfessionalUserMappingStudioID", bookingDetailsList.get(0).getUserMappingStudioID());
innerRequest.addProperty("tem:ConsumerUserMappingStudioID",loginCredentials.getUserMappingStudioId());
innerRequest.addProperty("tem:Cost",bookingDetailsList.get(0).getCost());
innerRequest.addProperty("tem:CardNumber", creditCardNo);
innerRequest.addProperty("tem:CardHolderName", creditCardHolder);
innerRequest.addProperty("tem:ExpirationDate", expirationDate);
innerRequest.addProperty("tem:CVV", cvv);
innerRequest.addProperty("tem:ProfessionalSessionID",bookingDetailsList.get(0).getProfessionalSessionID());
innerRequest.addProperty("tem:TxRefNum", "");
request.addProperty("tem:objCreditCardBookingPaymentRow",innerRequest);
utils.sysOut("some text", "" + request);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
String str = resultsRequestSOAP.toString();
Log.v("TAG_SOAP_ACTION", str);
Try like this:
SoapObject res=(SoapObject)envelope.bodyIn;
SoapObject t=(SoapObject)res.getProperty("MakeCreditCardPayment");
for(int i=0; i<t.getPropertyCount(); i++){
SoapObject carditCard=(SoapObject)t.getProperty(i);
String userID = carditCard.getProperty("ProfessionalUserMappingStudioID").toString();
}
I am trying to integrate salesforce with exacttarget using the SOAP wsdl provided by Exacttarget.
I am able to generate apex classes , but on calling the create request , I get the error System.CalloutException: Web service callout failed.
Since I am new to apex , I am not sure if SOAP header request can be done only through http ? or can I do it through my class.
Please find below the code I am using.
exacttargetComWsdlPartnerapi.Soap soapReq = new exacttargetComWsdlPartnerapi.Soap();
exacttargetComWsdlPartnerapi.UsernameAuthentication authentication = new exacttargetComWsdlPartnerapi.UsernameAuthentication();
authentication.UserName = '******';
authentication.PassWord = '*****';
soapReq.inputHttpHeaders_x = new Map<String, String>();
soapReq.outputHttpHeaders_x = new Map<String, String>();
//String myData = 'smruti.bhargava#accenture.com.etdev:smruti#123';
//authentication = EncodingUtil.base64Encode(Blob.valueOf(myData));
soapReq.inputHttpHeaders_x.put('Authorization','Basic ' + authentication );SALESFORCE STUB
exacttargetComWsdlPartnerapi.CreateOptions optList = new exacttargetComWsdlPartnerapi.CreateOptions();
exacttargetComWsdlPartnerapi.ContainerID contnr = new exacttargetComWsdlPartnerapi.ContainerID();
exacttargetComWsdlPartnerapi.APIObject apiObj = new exacttargetComWsdlPartnerapi.APIObject();
exacttargetComWsdlPartnerapi.APIProperty apiProp = new exacttargetComWsdlPartnerapi.APIProperty();
List<exacttargetComWsdlPartnerapi.APIProperty> propList = new List<exacttargetComWsdlPartnerapi.APIProperty>();
apiProp.Name='EmailAddress';
apiprop.Value='ash123#gmail.com';
propList.add(apiProp);
apiObj.PartnerProperties=propList;
contnr.APIObject = apiObj;
optList.Container = contnr;
List<exacttargetComWsdlPartnerapi.APIObject> objList = new List<exacttargetComWsdlPartnerapi.APIObject>();
objList.add(apiObj);
exacttargetComWsdlPartnerapi.CreateResponse_element response = soapReq.Create(optList,objList);
System.debug('** Result ==>' + response);
I am using apache commons httpclient version 4.2 to execute a simple web service based on SOAP 1.2. I am able to fire the web service properly through SOAP UI but I am unable to do the same using Java.
Following is the method I'm using to invoke the service.
private static byte[] callSOAPServer(String body, String SOAP_ACTION,
String SERVER_URL) {
byte[] result = null;
HttpParams httpParameters = new BasicHttpParams();
// Set the timeout in milliseconds until a connection is established.
int timeoutConnection = 15000;
HttpConnectionParams.setConnectionTimeout(httpParameters,
timeoutConnection);
// Set the default socket timeout (SO_TIMEOUT)
// in milliseconds which is the timeout for waiting for data.
int timeoutSocket = 35000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
DefaultHttpClient httpclient = new DefaultHttpClient(httpParameters);
/*
* httpclient.getCredentialsProvider().setCredentials( new
* AuthScope("os.icloud.com", 80, null, "Digest"), new
* UsernamePasswordCredentials(username, password));
*/
HttpPost httppost = new HttpPost(SERVER_URL);
httppost.setHeader("soapaction", SOAP_ACTION);
httppost.setHeader("Content-Type", "text/xml; charset=utf-8");
System.out.println("executing request" + httppost.getRequestLine());
// now create a soap request message as follows:
final StringBuffer soap = new StringBuffer();
soap.append("\n");
soap.append("");
// this is a sample data..you have create your own required data BEGIN
soap.append(" \n");
soap.append(" \n");
soap.append("" + body);
soap.append(" \n");
soap.append(" \n");
/* soap.append(body); */
// END of MEssage Body
soap.append("");
System.out.println("SOAP Request : " + soap.toString());
// END of full SOAP request message
try {
HttpEntity entity = new StringEntity(soap.toString(), HTTP.UTF_8);
httppost.setEntity(entity);
HttpResponse response = httpclient.execute(httppost);// calling
// server
HttpEntity r_entity = response.getEntity(); // get response
System.out.println("Reponse Header:Begin..."); // response headers
System.out.println("Reponse Header StatusLine:"
+ response.getStatusLine());
Header[] headers = response.getAllHeaders();
for (Header h : headers) {
System.out.println("Reponse Header " + h.getName() + ": "
+ h.getValue());
}
System.out.println("Reponse Header END...");
if (r_entity != null) {
result = new byte[(int) r_entity.getContentLength()];
if (r_entity.isStreaming()) {
DataInputStream is = new DataInputStream(
r_entity.getContent());
is.readFully(result);
}
}
} catch (Exception E) {
System.out.println("Exception While Connecting " + E.getMessage());
E.printStackTrace();
}
httpclient.getConnectionManager().shutdown(); // shut down the
// connection
return result;
}
Following is my SOAP Request as well as the end point.
String soapRequest = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:typ=\"http://skash.service.sahaj.com/types/\">"
+ "<soap:Header/>"
+ "<soap:Body>"
+ "<typ:remoteSKASHDeductionElement>"
+ "<typ:vleId>?</typ:vleId>"
+ "<typ:paidAmt>?</typ:paidAmt>"
+ "<typ:refTxnId>?</typ:refTxnId>"
+ "</typ:remoteSKASHDeductionElement>"
+ "</soap:Body>"
+ "</soap:Envelope>";
String soapEndPoint = "http://xxx.xxx.xxx.xxx:xxxx/skashws/remoteSKASHDeductionSoap12HttpPort";
String soapAction = "http://xxx.xxx.xxx.xxx:xxxx//remoteSKASHDeduction";
// executeSOAPRequest(soapRequest, soapEndPoint, soapAction);
byte[] resp = callSOAPServer(soapRequest, soapAction, soapEndPoint);
System.out.println(IOUtils.toString(resp));
I can see that the namespace set to Envelope tag is for SOAP 1.2 and is well set. I am not sure where I'm going wrong. I am receiving the following version mismatch error.
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<env:Upgrade>
<env:SupportedEnvelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" qname="soap12:Envelope"/>
</env:Upgrade>
</env:Header>
<env:Body>
<env:Fault xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>env:VersionMismatch</faultcode>
<faultstring>Version Mismatch</faultstring>
<faultactor>http://schemas.xmlsoap.org/soap/actor/next</faultactor>
</env:Fault>
</env:Body>
you may use this code block
public class GenericSoapMessageFactory extends SaajSoapMessageFactory implements InitializingBean {
#Override
public SaajSoapMessage createWebServiceMessage(InputStream inputStream) throws IOException {
setMessageFactoryForRequestContext(soap11);
if (inputStream instanceof TransportInputStream) {
TransportInputStream transportInputStream = (TransportInputStream) inputStream;
if (soapProtocolChooser.useSoap12(transportInputStream)) {
setMessageFactoryForRequestContext(soap12);
}
}
SaajSoapMessageFactory mf = getMessageFactoryForRequestContext();
return mf.createWebServiceMessage(inputStream);
}
}
And web.xml params
<servlet>
<servlet-name>spring-ws2</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>messageFactoryBeanName</param-name>
<param-value>genericSoapMessageFactory</param-value>
</init-param>
</servlet>
I saw this error once and I changed the following line;
httppost.setHeader("Content-Type", "text/xml; charset=utf-8");
to
httppost.setHeader("Content-Type", "application/soap+xml;charset=UTF-8;");
and it fixed the issue. Try it.
I would like to call .Net webservice from my Blackbrry application. How can I call webservice from my app and which protocol is user and which jar file i have to used to call webservice. and how to get responce from webservice in Blackberry?
you can use something like this (you probably need to setup correct request headers and cookies):
connection = (HttpConnection) Connector.open(url
+ ConnectionUtils.getConnectionString(), Connector.READ_WRITE);
connection.setRequestProperty("ajax","true");
connection.setRequestProperty("Cookie", "JSESSIONID=" + jsessionId);
inputStream = connection.openInputStream();
byte[] responseData = new byte[10000];
int length = 0;
StringBuffer rawResponse = new StringBuffer();
while (-1 != (length = inputStream.read(responseData))) {
rawResponse.append(new String(responseData, 0, length));
}
int responseCode = connection.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK) {
throw new IOException("HTTP response code: " + responseCode);
}
responseString = rawResponse.toString();