Doing a SOAP client call to a .NET server

C

Chris Berg

Hi all.

Before anyone atttacks me: I'm not looking for someone to write my
code, just to be led in the right direction.

I have to make a SOAP call from a Java client to an existing .NET
server. I have a working client example in VB6 plus Microsoft Soap
Type Library v3.0, that looks like this:

----------------------
Sub form_load()
Dim strWsdlURL, strServiceName, strServicePort, soapclient, strXML
strWsdlURL = "http://scws.host/SCWS.wsdl"
strServiceName = "SCWS"
strServicePort = "clsSCWSSoapPort"
Set soapclient = CreateObject("MSSOAP.SoapClient30")
Call soapclient.mssoapinit(strWsdlURL, strServiceName,
strServicePort)
strXML = soapclient.GetUserByID(1, "test1", "test2")
Text1.Text = strXML
End Sub
----------------------

I am not at all skilled in VB, but I get the general idea. I suppose
it is a matter of including some obscure part of JWSDP, and then more
or less 're-write' the VB code in Java.

I've downloaded the jwsdp from Sun, but it is quite overwelming:
Tomcat installed on the disk, and a tutorial that's OVER 1000 PAGES!!

I just don't have a clue where to begin. But I have a feeling the
solution is quite simple. Isn't that the whole idea with SOAP?
Simplicity? Ease of use? Fast development? Smooth integration?

Someone MUST have done this before !!

Chris
 
C

Christophe Vanfleteren

Chris said:
Hi all.

Before anyone atttacks me: I'm not looking for someone to write my
code, just to be led in the right direction.

I have to make a SOAP call from a Java client to an existing .NET
server. I have a working client example in VB6 plus Microsoft Soap
Type Library v3.0, that looks like this:

----------------------
Sub form_load()
Dim strWsdlURL, strServiceName, strServicePort, soapclient, strXML
strWsdlURL = "http://scws.host/SCWS.wsdl"
strServiceName = "SCWS"
strServicePort = "clsSCWSSoapPort"
Set soapclient = CreateObject("MSSOAP.SoapClient30")
Call soapclient.mssoapinit(strWsdlURL, strServiceName,
strServicePort)
strXML = soapclient.GetUserByID(1, "test1", "test2")
Text1.Text = strXML
End Sub
----------------------

I am not at all skilled in VB, but I get the general idea. I suppose
it is a matter of including some obscure part of JWSDP, and then more
or less 're-write' the VB code in Java.

I've downloaded the jwsdp from Sun, but it is quite overwelming:
Tomcat installed on the disk, and a tutorial that's OVER 1000 PAGES!!

Yes, but the jwsdp contains a lot more than just a SOAP engine (there is
Servlets, JSP, XML-processing (DOM, SAX),...), so that explains a large part
of the size of the documentation.

You'll need to study the jax-rpc an saaj chapters, which defines the way you
program a SOAP client.

You could also check out Axis, which is an opensource implementation of
JAX-RPC and SAAJ.
It has a pretty good user guide:
http://ws.apache.org/axis/java/user-guide.html

Axis also can autogenerate a lot of the boilerplate code from WSDL files.
I just don't have a clue where to begin. But I have a feeling the
solution is quite simple. Isn't that the whole idea with SOAP?
Simplicity? Ease of use? Fast development? Smooth integration?

I wouldn't call using SOAP any of those things. It is the best solution for
adhoc communication between different systems/platforms (like in your case),
but it is certainly not always the fastest or simplest solution to use.
 
A

Aaron Dykstra

Chris Berg said:
Hi all.

Before anyone atttacks me: I'm not looking for someone to write my
code, just to be led in the right direction.

I have to make a SOAP call from a Java client to an existing .NET
server. I have a working client example in VB6 plus Microsoft Soap
Type Library v3.0, that looks like this:

----------------------
Sub form_load()
Dim strWsdlURL, strServiceName, strServicePort, soapclient, strXML
strWsdlURL = "http://scws.host/SCWS.wsdl"
strServiceName = "SCWS"
strServicePort = "clsSCWSSoapPort"
Set soapclient = CreateObject("MSSOAP.SoapClient30")
Call soapclient.mssoapinit(strWsdlURL, strServiceName,
strServicePort)
strXML = soapclient.GetUserByID(1, "test1", "test2")
Text1.Text = strXML
End Sub
----------------------

I am not at all skilled in VB, but I get the general idea. I suppose
it is a matter of including some obscure part of JWSDP, and then more
or less 're-write' the VB code in Java.

I've downloaded the jwsdp from Sun, but it is quite overwelming:
Tomcat installed on the disk, and a tutorial that's OVER 1000 PAGES!!

I just don't have a clue where to begin. But I have a feeling the
solution is quite simple. Isn't that the whole idea with SOAP?
Simplicity? Ease of use? Fast development? Smooth integration?

Someone MUST have done this before !!

Chris

 Change your directory to a place where you are going to
create the jar file containing your web service client support
classes.
 Create an xml file that points to the target WSDL.
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
<wsdl location="http://158.52.209.176:8080/hello2/ws/Hello?WSDL"
packageName="sandbox.dykstaj.test">
</wsdl>
</configuration>
 Next create the support classes
C:\jwsdp-1.3\jaxrpc\bin\wscompile -gen:client
-httpproxy:proxy3.whirlpool.com:8080 DriverService.xml
 Jar up the support classes for import into your coding
environment.
 Add jars for soap and xml support: jaxb-xjc.jar,
saaj-api.jar, and saaj-impl.jar
 Create a java client that utilizes the classes you just
created.
/*
* Created on Nov 17, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package client;

import javax.xml.rpc.Stub;

import driver.client.BindService;
import driver.client.HelloService_Impl;

/**
* @author dykstaj
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class DriverClient
{

public static void main(String[] args)
{
try
{
Stub stub = createProxy();
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
"http://xxx.xxx.xxx.xxx:8080/hello2/ws/Hello");
BindService bind = (BindService) stub;
bind.write("<xml><command>start</command></xml>");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}

private static Stub createProxy()
{
// Note: HelloWorld_Impl is implementation-specific.
return (Stub) (new HelloService_Impl()).getBindServicePort();
}
}
 
X

X_AWemner_X

Before anyone atttacks me: I'm not looking for someone to write my
Here is a small client example using Axis soap provider and babelfish
translator.
http://koti.mbnet.fi/akini/java/axis/

You should check for the format of dotNet soap service. Older client
implementations might not understand default dotNet method. Older format is
RpcMethod call and new one Message(?) format.

I don't know whether Axis support both methods, but RpcMethod will work ok.

Use metadata tag "[SoapRpcMethod]" in dotNet method to use older format.using System;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Description="My First WS Test",
Namespace="http://www.mytest.com/")]
public class MathService : WebService {

[SoapRpcMethod]
[WebMethod(Description="sum given integers")]
public int sum(int a, int b) {
return (a + b);
}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top