cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community email address has changed to community-mailer@ptc.com. Learn more.

java - calling a webservice

ksperring
1-Newbie

java - calling a webservice

Hi,

Has anyone sucessfully called a webservice from an Arbortext initiated java class?

I specifically have an issue calling the service when the class is running in the Arbortext environment and am wondering if there are any other factors which I hsould be considering which may prevent me from performing such an action?

6 REPLIES 6

We call all sorts of .NET web services from the Arbortext JVM.
Are you creating your calls by hand, or using something like Axis?

Just to show some preemptive examples, here is the Ant task we use to create
the classes, both for an internal service, and external:
<target name="epicservice">
<axis-wsdl2java<br/> output="${src}"
verbose="true"
url=" >
</axis-wsdl2java>
</target>

<target name="pubmed">
<axis-wsdl2java<br/> output="${src}"
verbose="true"
url="
/>

</target>

This generates all of the classes we would use to access the service in
native Java src, which can then be modified if need be (though we tend to
use them as-is).

The only thing to be careful about (if using Microsoft services) is not to
use any object specific to the platform, but sticking to core SOAP
definitions works well.

keith


Hi Keith, Thanks for the pointers.

I'm using NetBeans to generate the WebService Reference etc. (BTW a .NET service which returns an int)

If I take my code and run it in a normal cmd line app it works 100%.

The moment I try invoke that method from my Arbortext initiated class, Arbortext raises an exception. (No java class for the object could be found)

If I remove that method call then Arbortext is quite happy and the XUI window displays.

so, I'm a little stumped?

I've done some checking and Netbeans is using jax-rpc to generate the web service code.

I've downloaded the axis plugin and will try using that now.

Are all of your dependent jar files located within custom/classes? (or some
suitable classpath, I suppose)
keith

On Thu, Nov 13, 2008 at 1:42 PM, Kevin Sperring <
kevin.sperring@lexisnexis.co.za> wrote:

> Hi Keith, Thanks for the pointers.
>
> I'm using NetBeans to generate the WebService Reference etc. (BTW a .NET
> service which returns an int)
>
> If I take my code and run it in a normal cmd line app it works 100%.
>
> The moment I try invoke that method from my Arbortext initiated class,
> Arbortext raises an exception. (No java class for the object could be found)
>
> If I remove that method call then Arbortext is quite happy and the XUI
> window displays.
>
> so, I'm a little stumped?
>
>

Ok,
Axis (at least the older version we're using) is pretty easy to use.

[YOUR_SERVICE]Locator loc = new [YOUR_SERVICE]Locator();
[YOUR_SERVICE]Soap port = loc.get[YOUR_SERVICE]Soap();

From there you should be able to simply call your method:

[YOUR_RETURN_TYPE] blah = port.[YOUR_METHOD_NAME(PARAMS)]

We've wrapped our first two calls in a singleton to avoid excessive lookups,
but the gist is there.

keith

On Thu, Nov 13, 2008 at 2:40 PM, Kevin Sperring <
kevin.sperring@lexisnexis.co.za> wrote:

> I've done some checking and Netbeans is using jax-rpc to generate the web
> service code.
>
> I've downloaded the axis plugin and will try using that now.
>
>