File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Call .NET Web Service From JAVA Client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Call .NET Web Service From JAVA Client " Watch "Call .NET Web Service From JAVA Client " New topic

Call .NET Web Service From JAVA Client

vijay saraf
Ranch Hand

Joined: Jan 08, 2005
Posts: 141
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( 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.

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 ]

Vijay Saraf.
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
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.

Spritle Software Blogs
vijay saraf
Ranch Hand

Joined: Jan 08, 2005
Posts: 141
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.


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 );
call.setOperationName(new QName ("", "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) {
i request you if you have any idea please reply me.
I agree. Here's the link:
subject: Call .NET Web Service From JAVA Client
It's not a secret anymore!