Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

web service problem ?

Status
Not open for further replies.

IPOz

Programmer
Jul 11, 2001
109
CN
Hi,friends,
Recently i downloaded apache-axis and deployed it on tomcat successfully.I can run its built-in samples,such as $(axis_home)/samples/addr.
In order to test web service's interoperability i used delphi6 to write a client program as below:
procedure TfrmAddr.Button1Click(Sender: TObject);
var
ro : AddressBook;
addr : address;
p : phone;
x :THTTPRio;
begin
x := THTTPRio.Create(nil);
x.HTTPWebNode.UseUTF8InHeader := true ;
x.WSDLLocation := 'h:\axis-1_0\samples\addr\AddressBook.wsdl';
x.Service := 'AddressBookService';
x.Port := 'AddressBook';

p := phone.Create;
p.areaCode := 765;
p.exchange := '494' ;
p.number := '4900';

addr := address.Create;
addr.streetNum := 1;
addr.streetName := 'University Drive' ;
addr.city := 'West Lafayette';
addr.zip := 47907;
addr.phoneNumber := p;

try
ro := x as AddressBook ;

ro.addEntry('Purdue Boilermaker',addr); //<=error here!
finally
addr.Free;
p.Free;
x.Free;
end;
end;

it always reports internal error ! Doesnot it mean delphi6 can NOT work with apache-axis ?

Any suggestion is appreciated ! ipo_z@cmmail.com
Garbage in,Garbage out
 
Up to now i can NOT make delphi work with axis so i am trying to find anothee way.Recently i found an article below however i am not sure whether JAsta works with delphi ?

--------------------------------------------------------

JAsta and JBoss

While Java has been less then perfect as a client, it's certainly hard to top when it comes to

servers. In fact J2EE servers are fast becoming a commodity which support EJBs largely in a

plug-and-play fashion.

Asta's origin includes technology which allows the developer to quickly build thin fast rich

clients capable of accessing a wide variety of RDBMS servers residing on Windows and

non-Windows platforms. Asta servers support client applications running on Windows, Palm, and

Win CE.

As Asta continues to evolve, it is natural to introduce a technology which allows a J2EE server

to directly support a native Windows client.

As is depicted in the diagram below, JAsta extends the Asta functionality to include an EJB

client API. This new API calls JAsta on the J2EE server which in turn calls the EJB.

The &quot;magic&quot; behind the scenes is a servlet which in turn calls a proxy service. This service,

the heart of JAsta, calls the EJB as needed making certain stateless and stateful, local and

remote, session and entity EJB functionality is all available to the native Windows

applications. Of course all this happens &quot;efficiently over the wire&quot; in a manner which has

become synonymous with Asta.

Java Application Servers are the proven choice for Enterprise Application Servers and

Enterprise Java Beans are the accepted method of coding Java Application Servers. Why not use

Java where it belongs, on the server, with small, fast Windows thin clients?

JAsta and JBoss

The JBoss configuration tested includes Tomcat. As of this writing the current stable versions

of the JBoss-Tomcat distribution is JBoss 2.4.4 and Tomcat 4.0.1 (Catalina). I suspect it's

possible to use the JBoss which does not include Tomcat (or Jetty) to get JAsta running with

JBoss (and it may even be easier for some) but I prefer the combination distribution because it

does work &quot;as-is&quot;.

Theoretically JBoss itself offers effortless deployment of EJBs. I have found this to be close

to truth when it comes to practice.

by Carl Mosca

The best programmer I know and I used to debate about good theories which cannot be put into

practice. He always argued they are not really good theories if they could not be put into

practice. I still won't admit I might have been wrong because I can't give up on the semantics

I think we were really debating.

Anyhow the jasta.war file is just about all it takes to get JAsta going on JBoss. This file

(jasta.war) should be copied into the deploy directory like any other package/bean/war one

might want to deploy. Because the magic of JAsta starts with a call to a servlet and we are

using Tomcat, it's also important to put a copy of jndi.properties in Tomcat's conf directory

or in the CLASSPATH. On our test environment this is the catalina/conf directory under the

JBOSS_DIST directory.

Now that we've got the quick-and-dirty what's needed for your average JBoss-aware developer,

let's start at the beginning. By the way I am working on a Win2000 machine.

What's needed?

* JBoss (the distribution with Tomcat) from jboss.org
* JDK 1.3+

Before you attempt to install JBoss you should have the JDK installed and make certain your

JAVA_HOME environment variable is set. If you are just getting started with Java a visit to

Sun's tutorials on setting up a Java development environment (on any platform) will be worth

the trip. I am going to assume the JDK 1.3+ is installed and usable.

To install JBoss, unzip the distribution archive into the directory of choice.

by Carl Mosca

I used the default name which includes the version of JBoss and Tomcat. If I were on my Linux

box I'd create a symbolic link to the directory but here in Win32 land I'll keep the ten-dollar

directory name and use environment variables when I am at the command-line.

In my case I unzipped to D:\ and I ended up with my top level JBoss directory being

D:\JBoss-2.4.4_Tomcat-4.0.1 (which I have pointed to by the JBOSS_DIST environment variable for

convenience). So after you unzip JBoss, I recommend adding a system environment variable called

JBOSS_DIST. This should point to the directory to which JBoss was unzipped. Therefore if you

change to %JBOSS_DIST% you should see two directories called jboss and catalina.

In case you are not familiar with adding environment variables here's a quick explanation. Go

to your desktop and right-click the &quot;My Computer&quot; icon. Select &quot;Properties&quot; and then go to the

&quot;Advanced&quot; tab. Click the &quot;Environment Variables&quot; button and then click the &quot;New&quot; button under

the list box which contains &quot;System Variables&quot;. The variable name in this case is &quot;JBOSS_DIST&quot;

(without the double quotes). The variable value in my case is &quot;D:\ JBoss-2.4.4_Tomcat-4.0.1&quot;

(again no quotes). After you click the &quot;Ok&quot; button the environment variable will be saved. The

*next* time you open a command prompt (I tend to live with at least one open), it will have the

new variable set.

Change to the jboss\bin directory and type &quot;run_with_catalina&quot;.

Press enter and assuming the JDK and JBoss installation are OK, JBoss will start. You will see

a bunch of messages (which may be reviewed in the server.log file found in the

%JBOSS_DIST%\jboss\log directory) and then finally the &quot;JBoss started&quot; message (or something

close to that) will appear. At some point you should review the log just so you'll become

familiar with it. If there are any startup or deployment problems you will want to start there.

Now that we've see it run, let's terminate the server by pressing Ctrl-C. After some more

messages fill the screen and add to the log file, the &quot;Shutdown complete&quot; message will appear.

This is followed by a &quot;Terminate batch job (Y/N)?&quot; prompt. Enter &quot;Y&quot; to terminate.

The JAsta demo comes with two files we need to copy to the JBoss deployment directory in order

to make the demo run. The first one is jasta.war (JAsta itself) and the second one is

JAstaEjbDemo.jar (the demo EJB we are going to call from our Delphi app).

Copy these two files to the %JBOSS_DIST%\jboss\deploy directory.

Because tomcat needs the access to the EJB interface we are also going to copy JAstaEjbDemo.jar

to the tomcat/lib directory. In our case this is the %JBOSS_DIST%\catalina\lib directory. Now

that we have JAsta and our demo EJB installed we can restart JBoss (actually JBoss will deploy

without restarting). Remember go to the %JBOSS_DIST%\bin directory and type &quot;run_with_catalina&quot;

to get JBoss started.

Now it's time to run our JAsta Delphi client. Go to the JAsta demo directory and type

&quot;JAstaTestClient&quot;. You will see a windows application that looks like this.

If you are running JAsta on the same machine and you have not modified the port settings, click

the &quot;Setup Connection&quot; button.

by Carl Mosca

If you are running the client and server on separate machines, enter the address in the JBoss

Server text box before clicking the &quot;Setup Connection&quot; button.

Now click the &quot;Access EJB Server&quot; tab and then click the &quot;Create EJB&quot; button.

You should see a message which says &quot;Created EJB Handle&quot; at this point. If you go back to the

shell (DOS box) in which JBoss is running you will see some activity there are well. Again the

messages here are also recorded to the JBoss log.

Now go back to the demo application and click the &quot;Credit/Debit Amount&quot; button. You will then

see a message indicating the current balance. Repeat the operation and you should see an

additional increase in the balance.

There you have it. An EJB running on JBoss and accessed from a native Windows app via JAsta!

Any suggestion is appreciated ! ipo_z@cmmail.com
Garbage in,Garbage out
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top