• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Call .NET Web Service From JAVA Client

 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
I have to make a web service client.I am doing this by appache-soap.
I have make One Proxy as follows.

inSide somemethod (this method i am calling in my client program)
{
org.apache.soap.messaging.Message _message = new org.apache.soap.messaging.Message();

//My Own Body
MessageBody mBody = new MessageBody ();

// Replace the default body with my body
this._envelop.setBody (mBody);
_message.send ("http://myDomain/SomeService/SomeService.asmx","http://myDomain/SomeService/SomeService.asmx/getEncryption", this._envelop);
try {
this.soapMessage_ = this._message.receive();
XMLReader reader = (XMLReader)Class.forName("org.apache.xerces.parsers.SAXParser").newInstance();
SAXHandler handler = new SAXHandler();
// .......Some Parsing Code
}
catch (Exception exception) {
exception.printStackTrace ();
}
}
Here i have made my own body (obviously by extending Body )and setted in envelop.
Send the message and try to parse the response given by service.
But i am getting the Exception as follows :

System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction .

i am little bit confused with send method of Message class. what exactly actionURI (arg no. 2) is.
API Specifies as Follows
public void send(java.net.URL url,java.lang.String actionURI,Envelope env) throws SOAPException
Send an envelope to the given URL via the SOAPTransport that has been configured for this instance (or SOAPHTTPConnection by default).
The envelope is sent exactly as-is.

Parameters:
url - the url to send to ( ?? )
actionURI - the value of the SOAPAction header ( ?? )
env - envelope to send


If any one have some hint ,example code or any thread link please tell me.

Actually I am Following This Link
Demo Code

Thanks & Regards,
Vijay Saraf.
[ August 10, 2006: Message edited by: vijay saraf ]
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With the given information i can only guess that the SOAP request sent from apachesoap is complaning to .net.
If possible try to use some soap monitor to see what requests is being sent and is that what you want to send.

Alternatively, it is better if you switch to Apache Axis as Apache Soap is outdated now.
 
vijay saraf
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Sir,

Actually i was trying with both,i am using eclipse 3.1, which generate default files with axis web service run time as bellow.
asuming KMSService.asmx as web service.

1) KMSService.java
2) KMSServiceLocator.java
3) KMSServiceSoap12Stub.java
4) KMSServiceSoapProxy.java
5) KMSServiceSoapStub.java

but i am confused, how to use those proxy and stub generated,
I have made Client as follows

public class TestClient {
public static void main(String [] args) {
try {
String endpoint = "http://MYDOMAIN/KMSService/KMSService.asmx";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName ("http://tempuri.org/", "getUserDetails"));

// I am confused with this line How can i pass my XML file in this.
String ret = (String) call.invoke( new Object[] { "HIRTYUASPWEBCUT10QWEYVBOIDNJH" } );

System.out.println("Result Is "+ ret );
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
i request you if you have any idea please reply me.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic