Web Hosting Talk







View Full Version : H-Sphere API/General SOAP+Axis help...


clarkmueller
02-04-2005, 08:22 PM
Hello everyone. Everything below the dashed line is part of a post I made on the pSoft forums, where my topic is currently the only one of the dozen or so on that page to have zero replies (after about 5 days). SO: I have decided to take this to WHT, where maybe someone familiar with SOAP/AXIS in general (although even better if you're familiar with H-Sphere) might be able to help me out with the errors I am receiving... Thank you in advance!

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

Greetings... I have concluded that in lieu of getting any kind of helpful response from pSoft via the trouble ticket system, I will take this to the forums and see if someone can give me a clear cut, simple example of utilizing H-Sphere's API via Axis in Java. Basically, here is what I would like to do: create an e-mail registration script that operates on a *remote* server from my H-Sphere CP. I am using WebObjects for this, which translates to my using Java, and thus Axis for SOAP. Admittedly, I am new to SOAP, but I have figured out the basics in the context of other apps, so I think that my problmes right now are something specific to the way H-Sphere does things.

As far as I am aware, I have enabled the API properly. It responds to test queries made using the test files provided by pSoft.

First, I need to generate some proper WSDL in order to generate my Java stubs for the H-Sphere MailServices API. My first expectation was that I would be able to go to my CP URL, and the AxisServlet, and click on one of the WSDL links to get WSDL for that particular service. pSoft's response to that was:

Dear sir,
the page http://123.456.789.123:8180/psoft/servlet/AxisServlet is just an interface. By default there are no ready servlets. You should create them yourself using our documentation as guide:

http://www.psoft.net/HSdocumentation/devel/hs_xml_api_ref.html
http://www.psoft.net/HSdocumentation/devel/hs_xml_api_enable.html

regards,
ronin
--
Andriy Pobereyko
Support Team (Level One)
Positive Software Corporation

Huh? Help me out here - how am I supposed to create a servlet if I can't generate any WSDL to work with? The documentation isn't going to do me a damn lot of good if I don't have a starting point.

What I got after that was that I was supposed to use java2wsdl to generate said WSDL. For what I want to do:

java org.apache.axis.wsdl.Java2WSDL -o MailServices.wsdl \
-l"http://my.cp.url:8080/psoft/servlet/AxisServlet" \
psoft.hsphere.axis.MailServices

I then go ahead and pull this into my development environment (on my other machine) and run WSDL2Java to create the stubs, etc.:

java org.apache.axis.wsdl.WSDL2Java MailServices.wsdl

and add that then to my project. Builds and compiles fine. I invoke it using the following chunk of code, whose goal is to create a mailbox using entered form data:


MailServicesServiceLocator locator = new MailServicesServiceLocator();
MailServices mailService = locator.getAxisServlet();
AuthToken at = new AuthToken();
at.setLogin("mycpuser");
at.setPassword("andpassword");
mailService.addMailbox(at, formData.username, "domain.com", formData.password, formData.name);


When triggered, this code tanks, with the following exception:

AxisFault
faultCode: {http://xml.apache.org/axis/}Server.NoService
faultString: The AXIS engine could not find a target service to invoke! targetService is null
faultActor: null
faultDetail:
stackTrace: AxisFault
faultCode: {http://xml.apache.org/axis/}Server.NoService
faultString: The AXIS engine could not find a target service to invoke! targetService is null
faultActor: null
faultDetail:

The AXIS engine could not find a target service to invoke! targetService is null

And then the stack trace. I can see that this is a general exception coming from Axis... Now, I notice, flipping through the code for the Stub etc. that there is an awful lot of "http://axis.hsphere.psoft", which I can't see as being a really useful service endpoint... The endpoint that I created while generating the WSDL is intact in the locator, but beyond that, I am a bit lost... Can someone else help me out here? FYI, AFAIK, the API is all up to date.