Home > Archive > Cobol > May 2007 > Re: Web Services and COBOL (Fairly long post, but I don't have time to write a proper
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Web Services and COBOL (Fairly long post, but I don't have time to write a proper
|
|
| Charles Hottel 2007-05-22, 9:55 pm |
|
"Pete Dashwood" <dashwood@removethis.enternet.co.nz> wrote in message
news:5beo1dF2s776oU1@mid.individual.net...
>
> "Charles Hottel" <chottel@earthlink.net> wrote in message
> news:epp4i.13336$j63.3581@newsread2.news.pas.earthlink.net...
> <snipped unreferenced previous>
>
>
> I'm really happy to help. I think it is important that we all share
> solutions, rather than do it through private mail. (Besides, it is quicker
> for me to post here than respond individually.)
>
>
> Java is a very useful OO language. You won't regret learning it. I prefer
> C# because it embodies the good parts of Java, but is more
> straightforward. (It has also been influenced by C++, and, again, takes
> the better parts of that language...). Most importantly though, C# is
> dedicated to DotNET and is the most facile solution for unlocking the
> power of the DotNET FCL (Framework Class Library), which has around 80,000
> classes in it... :-)
>
I have a feeling that I may never use Java at work, but then I am not good
at predicting the future. I am still interested in a language for my
retirement day's hobby programming and it could be Java but I think I should
also conside C#. I have an interest in AI and have a shelf full of books I
was saving for retirement, but after reading Kurzweil I have decide not to
wait. I will probably learn Scheme and/or Lisp at some point.
I know it will probably not be C++ although I have a shelf of book on that
as well.
I have learned far more about OO from learning Java than from C++ or OO
COBOL books. It is no silver bullet but I can see how it improves some
things.
| |
| Pete Dashwood 2007-05-22, 9:55 pm |
|
"Charles Hottel" <chottel@earthlink.net> wrote in message
news:6iM4i.12447$Ut6.3969@newsread1.news.pas.earthlink.net...
>
<snip>
>
> I have learned far more about OO from learning Java than from C++ or OO
> COBOL books. It is no silver bullet but I can see how it improves some
> things.
Yes, I had exactly the same experience. OO is such an innate part of Java
that it just seems completely natural.
For me, OO opens the way to component based design and programming. The code
posted in this thread is a concrete example of what I have been talking
about; the web service is simply a component exposed to the Internet. You
can plug it into your applications and not need to maintain it or worry
about it. (Conceptually it is just like an extension of the OS; you use it
every day and expect it to work as specified. It does what it does.)
Components may be the keys to the kingdom, unlocking Lamba functions and
functional programming and helping to move us toward Kurzweil's Singularity.
If you have a COBOL compiler on your home system, that supports OO, I would
urge you to try the code. (We will have a MicroFocus version any time now,
as well as the original Fujitsu NetCOBOL version which will work with ANY
version of Fujitsu COBOL, right back to version 3.)
Why not attempt a Java Class to access it? (Kinda to have COBOL being
invoked by Java across thousands of miles :-))
Researching how to access web services from Java is probably very useful for
both your Java and your web services learning.
If you get stuck, I can help.
I would LOVE to see an AcuCOBOL or Websphere version. It really is fun to
access web services, and very useful...
Pete.
| |
| Charles Hottel 2007-05-23, 6:55 pm |
|
"Pete Dashwood" <dashwood@removethis.enternet.co.nz> wrote in message
news:5bhj8jF2rrq02U1@mid.individual.net...
>
> "Charles Hottel" <chottel@earthlink.net> wrote in message
> news:6iM4i.12447$Ut6.3969@newsread1.news.pas.earthlink.net...
> <snip>
>
> Yes, I had exactly the same experience. OO is such an innate part of Java
> that it just seems completely natural.
>
> For me, OO opens the way to component based design and programming. The
> code posted in this thread is a concrete example of what I have been
> talking about; the web service is simply a component exposed to the
> Internet. You can plug it into your applications and not need to maintain
> it or worry about it. (Conceptually it is just like an extension of the
> OS; you use it every day and expect it to work as specified. It does what
> it does.)
>
> Components may be the keys to the kingdom, unlocking Lamba functions and
> functional programming and helping to move us toward Kurzweil's
> Singularity.
>
> If you have a COBOL compiler on your home system, that supports OO, I
> would urge you to try the code. (We will have a MicroFocus version any
> time now, as well as the original Fujitsu NetCOBOL version which will work
> with ANY version of Fujitsu COBOL, right back to version 3.)
>
> Why not attempt a Java Class to access it? (Kinda to have COBOL being
> invoked by Java across thousands of miles :-))
>
> Researching how to access web services from Java is probably very useful
> for both your Java and your web services learning.
>
> If you get stuck, I can help.
>
> I would LOVE to see an AcuCOBOL or Websphere version. It really is fun to
> access web services, and very useful...
>
> Pete.
>
>
I do not have any COBOL compiler on my PC. Well I have CDs with some very
old ones or university editions but I have not installed them.
I know Java has something called Java Webstart but it may not be the same as
invoking a web service. I think it is more like having your app on one
server and everybody runs it from there and you only update it there. Well I
do not know the details. Perhaps if Oliver reads this he can tell us. If I
can find the time I will try to figure out how to do this in Java to see
what I can learn.
| |
| Charles Hottel 2007-05-23, 9:55 pm |
|
"James J. Gavan" <jgavandeletethis@shaw.ca> wrote in message
news:vX25i.211534$DE1.22871@pd7urf2no...[color=darkred]
> Pete Dashwood wrote:
>
> Charles, I recall Thane writing the same thing, sometime back, about
> learning OO from Java. Exactly which OO COBOL books are you referring to
> ?
Well the best one was "Object Orientation for COBOL Programming" by Ray
Obin. It was good as far as it went but was pretty much an introduction.
The worst was "Object Oriented Development in COBOL" by Topper.
Somewhere in between was "Elements of Object Oriented COBOL" by Wilson
Price. I remember finding a lot of erros such as code not matching examples
etc. At one time I had a list of the errors but it has become irretrievably
lost.
I was always hampered by not having a compiler to experiment with.
| |
| Pete Dashwood 2007-05-23, 9:55 pm |
|
"James J. Gavan" <jgavandeletethis@shaw.ca> wrote in message
news:vX25i.211534$DE1.22871@pd7urf2no...
> Pete Dashwood wrote:
>
> Charles, I recall Thane writing the same thing, sometime back, about
> learning OO from Java. Exactly which OO COBOL books are you referring to
> ?
>
> Well you might have an M/F version soon - perhaps ? :-). I gotta
> problem. I have your WSDL-reference as one literal - so no problem
> there, just that I'm curious why it has a ?(question mark) instead a
> period.) before 'WSDL'.
The question mark is a standard way of posting parameters using HTTP POST
and GET. It is required.
>
> Independently I've used the highlighted WSDL-Reference in Google abd with
> and without 'WSDL' I get your main AVS Web Service Page or your your WSDL
> file layout. So the literal is complete.
Yes, that is expected behaviour. You should be able to input the URL into a
Browser and get the Web Service description.
http://primacomputing.co.nz/AVSWebS...WebService.asmx
...brings up the description, and clicking on the method shows samples opf
SOAP code that could be used at a very low level if you didn't have the SOAP
toolkit and were doing everything manually. (It is really just XML in and
XML out.)
>
> Problem seems to be with initializing SOAP; having referenced the SOAP
> toolkit I tried both the methods "mssoapinit" and "mssoapinit2" - the
> first gives a more verbose lists of errors - but essentially I don't
> think it's finding SOAP :-
>
> set not-finished to TRUE
> invoke MSSOAP "new" returning objSoapClient
Have you checked objSOAPClient to make sure it instantiated SOAP correctly?
If it didn't, you may not have SOAP installed on your system. This is where
an Object Browser comes in Handy :-). If you don't have one, run RegEdt32.
Do "find" on "MSSOAP.SoapClient". If it doesn't find it, you will need to
install the SOAP toolkit.
You can download it from:
http://www.microsoft.com/downloads/...&displaylang=en
It will install itself and you DON'T need to register it with Regsvr32 as it
is self-registering.
Then try the code again and see if the Class instantiates.
>Problem seems to be with initializing SOAP; having referenced the SOAP
>toolkit I tried both the methods "mssoapinit" and "mssoapinit2" - the
>first gives a more verbose lists of errors - but essentially I don't
>think it's finding SOAP :-
mssoapinit2 should not be used for this; it has a different parameter list.
>
> set not-finished to TRUE
> invoke MSSOAP "new" returning objSoapClient
> move length of wsdl-reference to ls-length
> invoke objSOAPClient "mssoapinit"
> using WSDL-reference
>
> The length above was just checking the actual size of the literal.
>
> I didn't want to get into all this SOAP SDK or M/F detail, but from
> viewing M/F demos I get the impression I have got to REGISTER SOAP and
> tell the application where it is on my disk.
No. Not nowadays. (Registration tells anything that wants to use it, where
it is)
All COM Servers need to be registered. This is done by a program called
Regsvr32 which is in your windows/system32 directory. However, if you are
reading docs that tell you to register SOAP, they must be very old. As noted
above, it is self-registering.
If you really want to be sure, you can open a DOS box and type: regsvr32
<path to mssoap.dll, for example: c:\windows\system32\mssoap.dll (check
where this .dll is located; it may vary on different systems)>
You can de-register a COM server with the same program, using the -u
parameter.
Registration makes the necessary entries in your system registry for the
Class, and ensures that only one copy (the copy you have registered) gets
used by anything that invokes it. You can overwrite the .dll (with a new
version, for example) and you don't have to re-register it again.
Any pointers ? As I'm using
> N/E V3.1 and you obviously were looking at M/F books before
No, I wasn't looking at MF Books; I simply located some MF code samples
posted by other people. Because I have a lot of experience at building and
using COM servers, I knew what to look for.
- see if the
> book 'Distributed Computing' can put me on right track :-
>
> http://supportline.microfocus.com/d...p1/nx31indx.htm
I went and had a look and found...
http://supportline.microfocus.com/d...1sp1/wspubb.htm
This looks like it could have been the basis for the code I found. It is way
out of date and SOAP 3.0 works differently.
This code shows the mssoapinit call as:
78 WSDL-Url value
z"http://www.xmethods.net/sd/2001/CATrafficService.wsdl".
01 WSML-Url pic x value x"00".
procedure division.
invoke MSSOAP "new" returning Soap
invoke Soap "mssoapinit" using WSDL-Url
z"CATrafficService"
z"CATrafficPort"
WSML-Url
mssoapinit for SOAP 3 does not need some of these parameters.
It may well be that COBOL passes the WSDL string without it needing to be
specified as ASCIIZ also. (COBOL may add the null to the end of it under the
covers). Not sure how MF COBOL passes strings to called routines.
You could try removing the z and simply passing the WSDL string as my code
does.
I'd need to see the errors you are getting before I can be sure.
>
> Here's an extract from one of the M/F Demos, (which of course is not
> on-line) :-
> -------------------------------------------------------------------------------
> HOW TO RUN THIS DEMO
This is a lot of sweat and totally not necessary for the instance we are
looking at.
You would only do this if you were BUILDING the COM Server... (It makes me
appreciate how much housekeeping Fujitsu do for you under the covers...)
I've snipped this as it is just muddying the water.
<snipped very tedious details that no one should have to wade through...
:-)>
>
> I would have thought if we get the correct link with the WSDL-Reference,
> then the program probably works as sweet as a nut.
Yes, I hope so... :-) It certainly does when I run it.
I think you have put your finger on it, Jimmy. We need to get the mssoapinit
call to function correctly.
I see the following steps:
1. Make sure you have the mssoap.dll installed as mentioned above.
2. Try defining the WSDL string with and without the z prefix.
I had a look around the web and SOAP 3 doesn't require the "extra"
parameters in the sample above. You must have the URL correct and that means
having the .asmx suffix and the question mark with WSDL after it.
If you can post the error messages you get (privately or here) I can
probably pin it down better.
3. If all else fails try...
78 WSDL-Url value
z"http://primacomputing.co.nz/AVSWebService/AVSWebService.asmx?WSDL".
01 WSML-Url pic x value x"00".
procedure division.
Having established a SOAP instance...(objSOAPClient is not null...)
invoke objSOAPClient "mssoapinit" using WSDL-Url
z"ValidateNZaddress"
z""
WSML-Url
end-invoke
>
> You know, there's nothing wrong with OO or COBOL - while important, it's
> all this extraneous crap, minute detail, permutations etc., that you have
> to get your head around for GUIs and Webbing - and it is not a quick
> 5-minute exercise to absorb this stuff. That's why I decided to call it
> quits with programming - I'm still enjoying and watching the grass grow,
> but bugger ! It's raining again and the grass needs cutting.
I completely agree. The mind numbing detail SHOULD be under the covers. (I
was shocked when I read what was there...it looks like MF use their own
registration process for servers when regsvr32 does it perfectly well. They
would argue it's done by a wizard so there's no need for people to worry
about it, and that is probably fair.)
>
> Meanwhile we have a N. American Robin (same size as an English Thrush),
> which has nested in the arm of one of our downpipes. Be fascinating to see
> if it stays the course and has babes.
No chance it will get washed away? (I'm thinking a miniature umbrella :-))
Pete.
| |
| Charles Hottel 2007-05-25, 3:55 am |
|
"Charles Hottel" <chottel@earthlink.net> wrote in message
news:%g45i.18421$3P3.8338@newsread3.news.pas.earthlink.net...[color=darkred]
>
> "Pete Dashwood" <dashwood@removethis.enternet.co.nz> wrote in message
> news:5bhj8jF2rrq02U1@mid.individual.net...
<snip>
Well I made an attempt at invoking your web service from Java, but I did not
have much spare time so it was not completely successful.
I only have one book that talk about Java and web services: Just Java 2 6th
edition and it is a little dated (2004). Chapter 28, mostly talks about two
beta programs through Amazon ans Google. While they looked straightforward
enough I decided I did not have time for that approach.
There is also the apache Axis package. I think when I have more time I will
try using it.
Basically they all process the WSDL and generate Java you can use in you
program to access the web servive.
I googled on "java invoke web service" and got more than 54 million hits
and there is lots of good stuff but most of it too long for the remaining
time I had left. At http://www.codeproject.com/soap/WSfromJava.asp I found
what looked like something short enough to try. It was a simple applet that
invoked a web service called ConcatWithSpace. It takes two string as input
and returns them concatenated with a space in the middle. One drawback is
it is for JDK 1.1. The entire web article is pretty short.
I downloaded the code, a Java program for the applet, which also has a
SoapRequestBuilder class, and a html page that invokes the applet and passes
the required parameters. I thought I could figure out the parms from your
WSDL and just change the web page to invoke your web service, but I must be
doing something wrong. I tried many variations but I always get: "Error:
access denied (java.net.SocketPermission)". Well I realize I am not
knowledgeable yet in this area of Java which is one reason for making the
attempt. Anyway I am sure this approach is not the best in general and Axis
is a better way to go. I see O''Reilly has a Java Web Services book. Just
what I need, another book added to my already very long list.
Here is the original html code for invoking the ConcatWithSpace service,
which I assume worked:
<HTML><HEAD>
<TITLE>Applet HTML Page</TITLE>
</HEAD>
<BODY>
<H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
<applet code="SOAPexample" width=400 height=50>
<param name="server" value="127.0.0.1">
<param name="method" value="ConcatWithSpace">
<param name="xmlnamespace" value="http://tempuri.org/">
<param name="webservicepath" value="/SimpleService/Service1.asmx">
<param name="string1" value="David">
<param name="string2" value="Hobbs">
</applet>
<HR WIDTH="100%">
</BODY></HTML>
Here is the modified version of the html:
<HTML><HEAD>
<TITLE>Applet HTML Page</TITLE>
</HEAD>
<BODY>
<H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
<applet code="SOAPexample" width=400 height=50>
<param name="server" value="http://primacomputing.co.nz/AVSWebService/">
<param name="method" value="ValidateNZAddress">
<param name="xmlnamespace"
value="http://primacomputing.co.nz/AVSWebService/">
<param name="webservicepath" value="/AVSWebService.asmx?WSDL">
<param name="string1" value="97 21ST AVE TAURANGA">
</applet>
<HR WIDTH="100%">
</BODY></HTML>
Here is the original Java code for the applet. I ran out of time ( I got
interrupted) before I could try to modify it. One change it needs for
certain is to comment out the logic for the second parameter being passed as
your web service only expects one input paramter. I did try running it
anyway in the hope that it would just ignore the second parameter. Perhaps
you or someone here can get it running. I am so sure that it is not the best
approach in general that I will wait until I can devote proper time to the
Axis approach. Well there might be even better ways, after all I am just a
couple hours into my investigations.
import java.applet.Applet;
import java.awt.*;
import java.net.*;
import java.util.*;
import java.io.*;
public class SOAPexample extends Applet {
private String response = "Nothing";
public void init() {
SoapRequestBuilder s = new SoapRequestBuilder();
s.Server = getParameter("server");
s.MethodName = getParameter("method");
s.XmlNamespace = getParameter("xmlnamespace");
s.WebServicePath = getParameter("webservicepath");
s.SoapAction = s.XmlNamespace+s.MethodName;
s.AddParameter("one", getParameter("string1"));
//s.AddParameter("two", getParameter("string2"));
response = s.sendRequest();
repaint();
}
public void paint(Graphics g) {
g.setColor(Color.black);
Font f = new Font("TimesRoman", 0, 20);
g.setFont(f);
g.drawString(response, 10, 20);
}
public void start() {
repaint();
}
}
class SoapRequestBuilder {
String Server = "";
String WebServicePath = "";
String SoapAction = "";
String MethodName = "";
String XmlNamespace = "";
private Vector ParamNames = new Vector();
private Vector ParamData = new Vector();
public void AddParameter(String Name, String Data) {
ParamNames.addElement( (Object) Name);
ParamData.addElement( (Object) Data);
}
public String sendRequest() {
String retval = "";
Socket socket = null;
try {
socket = new Socket(Server, 80);
}
catch (Exception ex1) {
return ("Error: "+ex1.getMessage());
}
try {
OutputStream os = socket.getOutputStream();
boolean autoflush = true;
PrintWriter out = new PrintWriter(socket.getOutputStream(),
autoflush);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.
getInputStream()));
int length = 295 + (MethodName.length() * 2) + XmlNamespace.length();
for (int t = 0; t < ParamNames.size(); t++) {
String name = (String) ParamNames.elementAt(t);
String data = (String) ParamData.elementAt(t);
length += name.length();
length += data.length();
}
// send an HTTP request to the web service
out.println("POST " + WebServicePath + " HTTP/1.1");
out.println("Host: localhost:80");
out.println("Content-Type: text/xml; charset=utf-8");
out.println("Content-Length: " + String.valueOf(length));
out.println("SOAPAction: \"" + SoapAction + "\"");
out.println("Connection: Close");
out.println();
out.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
out.println("<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/\">");
out.println("<soap:Body>");
out.println("<" + MethodName + " xmlns=\"" + XmlNamespace + "\">");
//Parameters passed to the method are added here
for (int t = 0; t < ParamNames.size(); t++) {
String name = (String) ParamNames.elementAt(t);
String data = (String) ParamData.elementAt(t);
out.println("<" + name + ">" + data + "</" + name + ">");
}
out.println("</" + MethodName + ">");
out.println("</soap:Body>");
out.println("</soap:Envelope>");
out.println();
// Read the response from the server ... times out if the response
takes
// more than 3 seconds
String inputLine;
StringBuffer sb = new StringBuffer(1000);
int wait_seconds = 3;
boolean timeout = false;
long m = System.currentTimeMillis();
while ( (inputLine = in.readLine()) != null && !timeout) {
sb.append(inputLine + "\n");
if ( (System.currentTimeMillis() - m) > (1000 * wait_seconds))
timeout = true;
}
in.close();
// The StringBuffer sb now contains the complete result from the
// webservice in XML format. You can parse this XML if you want to
// get more complicated results than a single value.
if (!timeout) {
String returnparam = MethodName + "Result";
int start = sb.toString().indexOf("<" + returnparam + ">") +
returnparam.length() + 2;
int end = sb.toString().indexOf("</" + returnparam + ">");
//Extract a singe return parameter
retval = sb.toString().substring(start, end);
}
else {
retval="Error: response timed out.";
}
socket.close();
}
catch (Exception ex) {
return ("Error: cannot communicate.");
}
return retval;
}
}
| |
| Charles Hottel 2007-05-25, 3:55 am |
|
"Charles Hottel" <chottel@earthlink.net> wrote in message
news:GPp5i.13254$Ut6.2582@newsread1.news.pas.earthlink.net...
>
> "Charles Hottel" <chottel@earthlink.net> wrote in message
> news:%g45i.18421$3P3.8338@newsread3.news.pas.earthlink.net...
> <snip>
>
> Well I made an attempt at invoking your web service from Java, but I did
> not have much spare time so it was not completely successful.
>
> I only have one book that talk about Java and web services: Just Java 2
> 6th edition and it is a little dated (2004). Chapter 28, mostly talks
> about two beta programs through Amazon ans Google. While they looked
> straightforward enough I decided I did not have time for that approach.
>
> There is also the apache Axis package. I think when I have more time I
> will try using it.
>
> Basically they all process the WSDL and generate Java you can use in you
> program to access the web servive.
>
> I googled on "java invoke web service" and got more than 54 million hits
> and there is lots of good stuff but most of it too long for the remaining
> time I had left. At http://www.codeproject.com/soap/WSfromJava.asp I found
> what looked like something short enough to try. It was a simple applet
> that invoked a web service called ConcatWithSpace. It takes two string as
> input and returns them concatenated with a space in the middle. One
> drawback is it is for JDK 1.1. The entire web article is pretty short.
>
> I downloaded the code, a Java program for the applet, which also has a
> SoapRequestBuilder class, and a html page that invokes the applet and
> passes the required parameters. I thought I could figure out the parms
> from your WSDL and just change the web page to invoke your web service,
> but I must be doing something wrong. I tried many variations but I always
> get: "Error: access denied (java.net.SocketPermission)". Well I realize I
> am not knowledgeable yet in this area of Java which is one reason for
> making the attempt. Anyway I am sure this approach is not the best in
> general and Axis is a better way to go. I see O''Reilly has a Java Web
> Services book. Just what I need, another book added to my already very
> long list.
>
> Here is the original html code for invoking the ConcatWithSpace service,
> which I assume worked:
>
> <HTML><HEAD>
> <TITLE>Applet HTML Page</TITLE>
> </HEAD>
>
> <BODY>
> <H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
>
> <applet code="SOAPexample" width=400 height=50>
> <param name="server" value="127.0.0.1">
> <param name="method" value="ConcatWithSpace">
> <param name="xmlnamespace" value="http://tempuri.org/">
> <param name="webservicepath" value="/SimpleService/Service1.asmx">
> <param name="string1" value="David">
> <param name="string2" value="Hobbs">
> </applet>
>
> <HR WIDTH="100%">
> </BODY></HTML>
>
> Here is the modified version of the html:
>
> <HTML><HEAD>
> <TITLE>Applet HTML Page</TITLE>
> </HEAD>
>
> <BODY>
> <H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
>
> <applet code="SOAPexample" width=400 height=50>
> <param name="server" value="http://primacomputing.co.nz/AVSWebService/">
> <param name="method" value="ValidateNZAddress">
> <param name="xmlnamespace"
> value="http://primacomputing.co.nz/AVSWebService/">
> <param name="webservicepath" value="/AVSWebService.asmx?WSDL">
> <param name="string1" value="97 21ST AVE TAURANGA">
> </applet>
>
> <HR WIDTH="100%">
> </BODY></HTML>
>
> Here is the original Java code for the applet. I ran out of time ( I got
> interrupted) before I could try to modify it. One change it needs for
> certain is to comment out the logic for the second parameter being passed
> as your web service only expects one input paramter. I did try running it
> anyway in the hope that it would just ignore the second parameter. Perhaps
> you or someone here can get it running. I am so sure that it is not the
> best approach in general that I will wait until I can devote proper time
> to the Axis approach. Well there might be even better ways, after all I am
> just a couple hours into my investigations.
>
> import java.applet.Applet;
> import java.awt.*;
> import java.net.*;
> import java.util.*;
> import java.io.*;
>
> public class SOAPexample extends Applet {
>
> private String response = "Nothing";
>
> public void init() {
> SoapRequestBuilder s = new SoapRequestBuilder();
> s.Server = getParameter("server");
> s.MethodName = getParameter("method");
> s.XmlNamespace = getParameter("xmlnamespace");
> s.WebServicePath = getParameter("webservicepath");
> s.SoapAction = s.XmlNamespace+s.MethodName;
> s.AddParameter("one", getParameter("string1"));
> //s.AddParameter("two", getParameter("string2"));
> response = s.sendRequest();
> repaint();
> }
>
> public void paint(Graphics g) {
> g.setColor(Color.black);
> Font f = new Font("TimesRoman", 0, 20);
> g.setFont(f);
> g.drawString(response, 10, 20);
> }
>
> public void start() {
> repaint();
> }
> }
>
> class SoapRequestBuilder {
> String Server = "";
> String WebServicePath = "";
> String SoapAction = "";
> String MethodName = "";
> String XmlNamespace = "";
> private Vector ParamNames = new Vector();
> private Vector ParamData = new Vector();
>
> public void AddParameter(String Name, String Data) {
> ParamNames.addElement( (Object) Name);
> ParamData.addElement( (Object) Data);
> }
>
> public String sendRequest() {
> String retval = "";
> Socket socket = null;
> try {
> socket = new Socket(Server, 80);
> }
> catch (Exception ex1) {
> return ("Error: "+ex1.getMessage());
> }
>
> try {
> OutputStream os = socket.getOutputStream();
> boolean autoflush = true;
> PrintWriter out = new PrintWriter(socket.getOutputStream(),
> autoflush);
> BufferedReader in = new BufferedReader(new InputStreamReader(socket.
> getInputStream()));
>
> int length = 295 + (MethodName.length() * 2) + XmlNamespace.length();
> for (int t = 0; t < ParamNames.size(); t++) {
> String name = (String) ParamNames.elementAt(t);
> String data = (String) ParamData.elementAt(t);
> length += name.length();
> length += data.length();
> }
>
> // send an HTTP request to the web service
> out.println("POST " + WebServicePath + " HTTP/1.1");
> out.println("Host: localhost:80");
> out.println("Content-Type: text/xml; charset=utf-8");
> out.println("Content-Length: " + String.valueOf(length));
> out.println("SOAPAction: \"" + SoapAction + "\"");
> out.println("Connection: Close");
> out.println();
>
> out.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
> out.println("<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/\">");
> out.println("<soap:Body>");
> out.println("<" + MethodName + " xmlns=\"" + XmlNamespace + "\">");
> //Parameters passed to the method are added here
> for (int t = 0; t < ParamNames.size(); t++) {
> String name = (String) ParamNames.elementAt(t);
> String data = (String) ParamData.elementAt(t);
> out.println("<" + name + ">" + data + "</" + name + ">");
> }
> out.println("</" + MethodName + ">");
> out.println("</soap:Body>");
> out.println("</soap:Envelope>");
> out.println();
>
> // Read the response from the server ... times out if the response
> takes
> // more than 3 seconds
> String inputLine;
> StringBuffer sb = new StringBuffer(1000);
>
> int wait_seconds = 3;
> boolean timeout = false;
> long m = System.currentTimeMillis();
> while ( (inputLine = in.readLine()) != null && !timeout) {
> sb.append(inputLine + "\n");
> if ( (System.currentTimeMillis() - m) > (1000 * wait_seconds))
> timeout = true;
> }
> in.close();
>
> // The StringBuffer sb now contains the complete result from the
> // webservice in XML format. You can parse this XML if you want to
> // get more complicated results than a single value.
>
> if (!timeout) {
> String returnparam = MethodName + "Result";
> int start = sb.toString().indexOf("<" + returnparam + ">") +
> returnparam.length() + 2;
> int end = sb.toString().indexOf("</" + returnparam + ">");
>
> //Extract a singe return parameter
> retval = sb.toString().substring(start, end);
> }
> else {
> retval="Error: response timed out.";
> }
>
> socket.close();
> }
> catch (Exception ex) {
> return ("Error: cannot communicate.");
> }
>
> return retval;
> }
> }
>
>
Sorry the web service is SimpleService/Service1.asmx and the method name is
ConcatWithSpace.
| |
| Pete Dashwood 2007-05-25, 7:55 am |
| Hi Charlie,
I had a quick look at this but there are too many things wrong with it for
me to fix it at the moment.
The Web Page is fine (I have one question on it but don't have time to check
it out) but there are problems in the Java Applet. If the SOAP Class is
invoked it shouldn't require a socket connection (it will make its own) and
it looks to me as if you are doing something that is very low level (and
unnecessary, if the SOAP COM server is used, as Jimmy and I did.)
I'm flat out this w end doing a major address conversion with the AVS
engine, but I'll have a look at it next w if none of the Java experts
here have picked it up meanwhile, or if you haven't been able to do it
yourself...
Thanks for having a go... I bet you learned something :-)
Pete.
TOP POST - nothing new below.
"Charles Hottel" <chottel@earthlink.net> wrote in message
news:GPp5i.13254$Ut6.2582@newsread1.news.pas.earthlink.net...
>
> "Charles Hottel" <chottel@earthlink.net> wrote in message
> news:%g45i.18421$3P3.8338@newsread3.news.pas.earthlink.net...
> <snip>
>
> Well I made an attempt at invoking your web service from Java, but I did
> not have much spare time so it was not completely successful.
>
> I only have one book that talk about Java and web services: Just Java 2
> 6th edition and it is a little dated (2004). Chapter 28, mostly talks
> about two beta programs through Amazon ans Google. While they looked
> straightforward enough I decided I did not have time for that approach.
>
> There is also the apache Axis package. I think when I have more time I
> will try using it.
>
> Basically they all process the WSDL and generate Java you can use in you
> program to access the web servive.
>
> I googled on "java invoke web service" and got more than 54 million hits
> and there is lots of good stuff but most of it too long for the remaining
> time I had left. At http://www.codeproject.com/soap/WSfromJava.asp I found
> what looked like something short enough to try. It was a simple applet
> that invoked a web service called ConcatWithSpace. It takes two string as
> input and returns them concatenated with a space in the middle. One
> drawback is it is for JDK 1.1. The entire web article is pretty short.
>
> I downloaded the code, a Java program for the applet, which also has a
> SoapRequestBuilder class, and a html page that invokes the applet and
> passes the required parameters. I thought I could figure out the parms
> from your WSDL and just change the web page to invoke your web service,
> but I must be doing something wrong. I tried many variations but I always
> get: "Error: access denied (java.net.SocketPermission)". Well I realize I
> am not knowledgeable yet in this area of Java which is one reason for
> making the attempt. Anyway I am sure this approach is not the best in
> general and Axis is a better way to go. I see O''Reilly has a Java Web
> Services book. Just what I need, another book added to my already very
> long list.
>
> Here is the original html code for invoking the ConcatWithSpace service,
> which I assume worked:
>
> <HTML><HEAD>
> <TITLE>Applet HTML Page</TITLE>
> </HEAD>
>
> <BODY>
> <H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
>
> <applet code="SOAPexample" width=400 height=50>
> <param name="server" value="127.0.0.1">
> <param name="method" value="ConcatWithSpace">
> <param name="xmlnamespace" value="http://tempuri.org/">
> <param name="webservicepath" value="/SimpleService/Service1.asmx">
> <param name="string1" value="David">
> <param name="string2" value="Hobbs">
> </applet>
>
> <HR WIDTH="100%">
> </BODY></HTML>
>
> Here is the modified version of the html:
>
> <HTML><HEAD>
> <TITLE>Applet HTML Page</TITLE>
> </HEAD>
>
> <BODY>
> <H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
>
> <applet code="SOAPexample" width=400 height=50>
> <param name="server" value="http://primacomputing.co.nz/AVSWebService/">
> <param name="method" value="ValidateNZAddress">
> <param name="xmlnamespace"
> value="http://primacomputing.co.nz/AVSWebService/">
> <param name="webservicepath" value="/AVSWebService.asmx?WSDL">
> <param name="string1" value="97 21ST AVE TAURANGA">
> </applet>
>
> <HR WIDTH="100%">
> </BODY></HTML>
>
> Here is the original Java code for the applet. I ran out of time ( I got
> interrupted) before I could try to modify it. One change it needs for
> certain is to comment out the logic for the second parameter being passed
> as your web service only expects one input paramter. I did try running it
> anyway in the hope that it would just ignore the second parameter. Perhaps
> you or someone here can get it running. I am so sure that it is not the
> best approach in general that I will wait until I can devote proper time
> to the Axis approach. Well there might be even better ways, after all I am
> just a couple hours into my investigations.
>
> import java.applet.Applet;
> import java.awt.*;
> import java.net.*;
> import java.util.*;
> import java.io.*;
>
> public class SOAPexample extends Applet {
>
> private String response = "Nothing";
>
> public void init() {
> SoapRequestBuilder s = new SoapRequestBuilder();
> s.Server = getParameter("server");
> s.MethodName = getParameter("method");
> s.XmlNamespace = getParameter("xmlnamespace");
> s.WebServicePath = getParameter("webservicepath");
> s.SoapAction = s.XmlNamespace+s.MethodName;
> s.AddParameter("one", getParameter("string1"));
> //s.AddParameter("two", getParameter("string2"));
> response = s.sendRequest();
> repaint();
> }
>
> public void paint(Graphics g) {
> g.setColor(Color.black);
> Font f = new Font("TimesRoman", 0, 20);
> g.setFont(f);
> g.drawString(response, 10, 20);
> }
>
> public void start() {
> repaint();
> }
> }
>
> class SoapRequestBuilder {
> String Server = "";
> String WebServicePath = "";
> String SoapAction = "";
> String MethodName = "";
> String XmlNamespace = "";
> private Vector ParamNames = new Vector();
> private Vector ParamData = new Vector();
>
> public void AddParameter(String Name, String Data) {
> ParamNames.addElement( (Object) Name);
> ParamData.addElement( (Object) Data);
> }
>
> public String sendRequest() {
> String retval = "";
> Socket socket = null;
> try {
> socket = new Socket(Server, 80);
> }
> catch (Exception ex1) {
> return ("Error: "+ex1.getMessage());
> }
>
> try {
> OutputStream os = socket.getOutputStream();
> boolean autoflush = true;
> PrintWriter out = new PrintWriter(socket.getOutputStream(),
> autoflush);
> BufferedReader in = new BufferedReader(new InputStreamReader(socket.
> getInputStream()));
>
> int length = 295 + (MethodName.length() * 2) + XmlNamespace.length();
> for (int t = 0; t < ParamNames.size(); t++) {
> String name = (String) ParamNames.elementAt(t);
> String data = (String) ParamData.elementAt(t);
> length += name.length();
> length += data.length();
> }
>
> // send an HTTP request to the web service
> out.println("POST " + WebServicePath + " HTTP/1.1");
> out.println("Host: localhost:80");
> out.println("Content-Type: text/xml; charset=utf-8");
> out.println("Content-Length: " + String.valueOf(length));
> out.println("SOAPAction: \"" + SoapAction + "\"");
> out.println("Connection: Close");
> out.println();
>
> out.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
> out.println("<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/\">");
> out.println("<soap:Body>");
> out.println("<" + MethodName + " xmlns=\"" + XmlNamespace + "\">");
> //Parameters passed to the method are added here
> for (int t = 0; t < ParamNames.size(); t++) {
> String name = (String) ParamNames.elementAt(t);
> String data = (String) ParamData.elementAt(t);
> out.println("<" + name + ">" + data + "</" + name + ">");
> }
> out.println("</" + MethodName + ">");
> out.println("</soap:Body>");
> out.println("</soap:Envelope>");
> out.println();
>
> // Read the response from the server ... times out if the response
> takes
> // more than 3 seconds
> String inputLine;
> StringBuffer sb = new StringBuffer(1000);
>
> int wait_seconds = 3;
> boolean timeout = false;
> long m = System.currentTimeMillis();
> while ( (inputLine = in.readLine()) != null && !timeout) {
> sb.append(inputLine + "\n");
> if ( (System.currentTimeMillis() - m) > (1000 * wait_seconds))
> timeout = true;
> }
> in.close();
>
> // The StringBuffer sb now contains the complete result from the
> // webservice in XML format. You can parse this XML if you want to
> // get more complicated results than a single value.
>
> if (!timeout) {
> String returnparam = MethodName + "Result";
> int start = sb.toString().indexOf("<" + returnparam + ">") +
> returnparam.length() + 2;
> int end = sb.toString().indexOf("</" + returnparam + ">");
>
> //Extract a singe return parameter
> retval = sb.toString().substring(start, end);
> }
> else {
> retval="Error: response timed out.";
> }
>
> socket.close();
> }
> catch (Exception ex) {
> return ("Error: cannot communicate.");
> }
>
> return retval;
> }
> }
>
>
| |
| Charles Hottel 2007-05-28, 9:55 pm |
| Top Post not more below
Hi! Pete,
I downloaded Axis 1.4 and if it works as the documentation says I believe it
would not be too difficult to do the few steps required to invoke a web
service.
Not sure when I might get around to it though.
My wife is pregnant and we spent today in the emergency room as she was
experiencing severe pain on her left side. They think the cause of the pain
is not a threat to the baby, but the sonogram showed a possible birth defect
( a hole in the abdominal wall), something like a hernia. Tomorrow they will
give us the name of a specialist. If this is the only problem and if the
baby can develop long enough then he/she may have a chance. However 25% to
40% of the babies with this problem have other birth defects. I am feeling
kind of low and web services will have to take a back seat for quite a
while.
Sorry to lay this on you. I do not have a lot of friends and some of the
ones I did have disapproved of my latest marraige and abandoned our
friendship. I tried calling my two children but they are not home. The
people on this group are pretty much the closest thing I have to friends and
I just had to let this out to someone.
"Pete Dashwood" <dashwood@removethis.enternet.co.nz> wrote in message
news:5bnqv4F2rp0c0U1@mid.individual.net...
> Hi Charlie,
>
> I had a quick look at this but there are too many things wrong with it for
> me to fix it at the moment.
>
> The Web Page is fine (I have one question on it but don't have time to
> check it out) but there are problems in the Java Applet. If the SOAP Class
> is invoked it shouldn't require a socket connection (it will make its own)
> and it looks to me as if you are doing something that is very low level
> (and unnecessary, if the SOAP COM server is used, as Jimmy and I did.)
>
> I'm flat out this w end doing a major address conversion with the AVS
> engine, but I'll have a look at it next w if none of the Java experts
> here have picked it up meanwhile, or if you haven't been able to do it
> yourself...
>
> Thanks for having a go... I bet you learned something :-)
>
> Pete.
>
> TOP POST - nothing new below.
>
>
>
> "Charles Hottel" <chottel@earthlink.net> wrote in message
> news:GPp5i.13254$Ut6.2582@newsread1.news.pas.earthlink.net...
>
>
| |
| Pete Dashwood 2007-05-28, 9:55 pm |
|
"Charles Hottel" <chottel@earthlink.net> wrote in message
news:6dL6i.16043$j63.2521@newsread2.news.pas.earthlink.net...
> Top Post not more below
>
> Hi! Pete,
>
> I downloaded Axis 1.4 and if it works as the documentation says I believe
> it would not be too difficult to do the few steps required to invoke a web
> service.
> Not sure when I might get around to it though.
>
> My wife is pregnant and we spent today in the emergency room as she was
> experiencing severe pain on her left side. They think the cause of the
> pain is not a threat to the baby, but the sonogram showed a possible birth
> defect ( a hole in the abdominal wall), something like a hernia. Tomorrow
> they will give us the name of a specialist. If this is the only problem
> and if the baby can develop long enough then he/she may have a chance.
> However 25% to 40% of the babies with this problem have other birth
> defects. I am feeling kind of low and web services will have to take a
> back seat for quite a while.
>
> Sorry to lay this on you.
Absolutely do NOT apologise... :-) There isn't much any of us here can do,
apart from give you moral support. Speaking only for myself, you have it.
> I do not have a lot of friends and some of the ones I did have disapproved
> of my latest marraige and abandoned our friendship.
With "friends" like that, you don't need enemies. People who would judge you
for your personal actions, which have nothing to do with anyone else, are
people who you are probably better off without.
> I tried calling my two children but they are not home. The people on this
> group are pretty much the closest thing I have to friends and I just had
> to let this out to someone.
I understand. Glad you did. I'm sure some here will know what you are going
through, and most can empathise with the stress you are under.
Don't worry at all about the web services :-)
My exercise over the w end went very successfully and I am under less
pressure now than I was, although I still have a huge amount of work to do
on the AVS web site. (I spent most of this morning furthering my education
via a Web Cast on Master Pages and Themes (all really good stuff; I am
persuaded to stop with CSS and go to themes instead :-)))
On the web service from Java...
I see the real problem as being able to access COM from Java (Once you
establish connection to the SOAP COM proxy, the rest is just stamp
collecting :-)). Bearing this in mind, I found that IBM are offering an
approach that is free and looks very useful. I have downloaded their
Bridge2Java software from the article "Bridging the gap to COM"
http://www.ibm.com/developerworks/j...brary/j-bridge/
From my web searches I found a number of offerings that did the same; some
of them were really excellent, but expensive...
If I can find some time and need a break from C# and Web stuff, I'll attempt
to implement the Java link to the web service.
However, it might be interesting to compare the IBM approach with the Axis
one, so please do it if you have time or need to bury yourself in something
that may help to take your mind off your immmediate problems. (In the course
of my life I have found working to be a very useful therapy when trauma
strikes...but that might just be me.)
Meantime, very best wishes for a safe delivery with mother and child both
fine. Try not to let it get you down.
Pete.
<previous unreferenced snipped>
| |
| Pete Dashwood 2007-05-29, 3:55 am |
|
"LX-i" <lxi0007@netscape.net> wrote in message
news:V7GdnePvfu-xCMbbnZ2dnUVZ_ualnZ2d@comcast.com...
> Pete Dashwood wrote:
>
> Nah - don't dump CSS. Master pages with a good CSS file will work out
> well.
But Dan, I want to have a .skin file and name it "fore"...:-)
>
> On a completely off-topic, unrelated topic - I just made a change to a
> theme (WordPress, not dotNet) using CSS and a custom image. It's on my
> new "w ly devotions" site - anywhere there's a quote from the Bible,
> it's got a ribbon on the bottom that looks like a bookmark. It's linked
> from my personal blog's home page under "W ly Devotions".
Well, could you do the decent thing and post a link then, please... :-)
Pete.
| |
|
| In article <6dL6i.16043$j63.2521@newsread2.news.pas.earthlink.net>,
Charles Hottel <chottel@earthlink.net> wrote:
[snip]
>If this is the only problem and if the
>baby can develop long enough then he/she may have a chance. However 25% to
>40% of the babies with this problem have other birth defects.
Odds like this are given so that you may exult in beating them. Best
wishes, Mr Hottel, to all involved for a rapid convalesences and full
recoveries.
DD
| |
| Paul Raulerson 2007-05-29, 9:55 pm |
| The people here have been here (a lot of us) for a decade or more. I cannot
think of a better definition of a friend than someone you you can talk with.
My daughter has a severe oxygen deprevation while she was being born, and as
a result has a moderately severe retardation. She also suffers from
epileptic seizures, which terrify all of us. She woke up the other night
afraid she was going to die.
She has slept in our bed for the past w , and I have been ejoying the
hospitality of the couch. (*sigh*) She is worth it, and even if your child
has birthh defects, it won't really matter to you. Trust me on that.
Our prayers and best wishes are with you.
-Paul & Karen
"Charles Hottel" <chottel@earthlink.net> wrote in message
news:6dL6i.16043$j63.2521@newsread2.news.pas.earthlink.net...
> Top Post not more below
>
> Hi! Pete,
>
> I downloaded Axis 1.4 and if it works as the documentation says I believe
> it would not be too difficult to do the few steps required to invoke a web
> service.
> Not sure when I might get around to it though.
>
> My wife is pregnant and we spent today in the emergency room as she was
> experiencing severe pain on her left side. They think the cause of the
> pain is not a threat to the baby, but the sonogram showed a possible birth
> defect ( a hole in the abdominal wall), something like a hernia. Tomorrow
> they will give us the name of a specialist. If this is the only problem
> and if the baby can develop long enough then he/she may have a chance.
> However 25% to 40% of the babies with this problem have other birth
> defects. I am feeling kind of low and web services will have to take a
> back seat for quite a while.
>
> Sorry to lay this on you. I do not have a lot of friends and some of the
> ones I did have disapproved of my latest marraige and abandoned our
> friendship. I tried calling my two children but they are not home. The
> people on this group are pretty much the closest thing I have to friends
> and I just had to let this out to someone.
>
> "Pete Dashwood" <dashwood@removethis.enternet.co.nz> wrote in message
> news:5bnqv4F2rp0c0U1@mid.individual.net...
>
>
| |
| Charles Hottel 2007-05-31, 6:55 pm |
|
"Pete Dashwood" <dashwood@removethis.enternet.co.nz> wrote in message
news:5c1hsnF2uuqhfU1@mid.individual.net...
>
> "Charles Hottel" <chottel@earthlink.net> wrote in message
> news:6dL6i.16043$j63.2521@newsread2.news.pas.earthlink.net...
>
> Absolutely do NOT apologise... :-) There isn't much any of us here can
> do, apart from give you moral support. Speaking only for myself, you have
> it.
>
>
>
> With "friends" like that, you don't need enemies. People who would judge
> you for your personal actions, which have nothing to do with anyone else,
> are people who you are probably better off without.
>
>
> I understand. Glad you did. I'm sure some here will know what you are
> going through, and most can empathise with the stress you are under.
>
> Don't worry at all about the web services :-)
>
> My exercise over the w end went very successfully and I am under less
> pressure now than I was, although I still have a huge amount of work to do
> on the AVS web site. (I spent most of this morning furthering my education
> via a Web Cast on Master Pages and Themes (all really good stuff; I am
> persuaded to stop with CSS and go to themes instead :-)))
>
> On the web service from Java...
> I see the real problem as being able to access COM from Java (Once you
> establish connection to the SOAP COM proxy, the rest is just stamp
> collecting :-)). Bearing this in mind, I found that IBM are offering an
> approach that is free and looks very useful. I have downloaded their
> Bridge2Java software from the article "Bridging the gap to COM"
>
> http://www.ibm.com/developerworks/j...brary/j-bridge/
>
> From my web searches I found a number of offerings that did the same; some
> of them were really excellent, but expensive...
>
> If I can find some time and need a break from C# and Web stuff, I'll
> attempt to implement the Java link to the web service.
>
> However, it might be interesting to compare the IBM approach with the Axis
> one, so please do it if you have time or need to bury yourself in
> something that may help to take your mind off your immmediate problems.
> (In the course of my life I have found working to be a very useful therapy
> when trauma strikes...but that might just be me.)
>
> Meantime, very best wishes for a safe delivery with mother and child both
> fine. Try not to let it get you down.
>
> Pete.
>
>
>
> <previous unreferenced snipped>
>
I have not spent a lot of time searching but I saw JACOB: JAva COm Bridge
and something from IBM at www.alphaworks.ibm.com/tech/dtjcb
IIRC with Axis I just need to:
1. add a path to the .jar files to my CLASSPATH
2. run wsdl2java program against the wsdl
3. write short java program to invoke the web services using the java
generated in step 2
Well that is just from a quick glance at the documantation several days ago.
| |
| Pete Dashwood 2007-05-31, 6:55 pm |
|
"Charles Hottel" <chottel@earthlink.net> wrote in message
news:cJD7i.15340$Ut6.7789@newsread1.news.pas.earthlink.net...
>
> "Pete Dashwood" <dashwood@removethis.enternet.co.nz> wrote in message
> news:5c1hsnF2uuqhfU1@mid.individual.net...
>
> I have not spent a lot of time searching but I saw JACOB: JAva COm Bridge
> and something from IBM at www.alphaworks.ibm.com/tech/dtjcb
>
> IIRC with Axis I just need to:
>
> 1. add a path to the .jar files to my CLASSPATH
> 2. run wsdl2java program against the wsdl
> 3. write short java program to invoke the web services using the java
> generated in step 2
>
> Well that is just from a quick glance at the documantation several days
> ago.
>
Yes, the trick is to have something that generates proxy classes for COM
access. Bridge2Java does this. It isn't just about web services, as noted
elsewhere. Rather than generating code from the wsdl, you can generate code
from a COM .olb or typelib. This gives you the interface to that COM
component, and that (using the SOAP Toolkit COM component
(MSSOAP.SoapClient30) analyses the wsdl and does the web service call,
exactly as the COBOL posted by Jimmy and myself.
There are a number of approaches to accessing a web service from Java
(anything that works is pretty much all right... :-)) but using a standard
component is my preferred one. I believe the code for this approach will be
considerably less than with the direct approach, because there is more under
the covers of the COM component. That's the whole point of components; they
provide encapsulated functionality so you don't have to keep writing it.
I'm really deep into the AVS website, demos, and downloads currently so I
can't really look at this right now, but I hope to later (certainly before
the Singularity... :-))
Pete.
Pete.
|
|
|
|
|