I solved my initial problem. In my Eclipse project I was referencing some
jars in the plugin folder. I removed all of those references and readded
the packages in axis2/lib.
However I am still having authentication issues. I can create my stub class
just fine, but when I create the response object I get an exception. The
exception is different this time however. Here is my code again.
DocInfoStub stub = null;
//ServiceClient sc = null;
HttpTransportProperties.Authenticator authenticator = new
HttpTransportProperties.Authenticator();
authenticator.setUsername("sysadmin");
authenticator.setPassword("idc");
Options options = new Options();
options.setProperty(HttpTransportProperties.Authenticator.BASIC,
authenticator);
stub = new DocInfoStub("http://localhost/stellent/idcplg");
stub._getServiceClient().setOptions(options);
DocInfoStub.DocInfoByName request = new DocInfoStub.DocInfoByName();
request.setDDocName("cslptysonm_000107");
DocInfoStub.DocInfoByNameResponse response = stub.DocInfoByName(request);
<-- Exception here.
DocInfoStub.DocInfoByNameResult result = response.getDocInfoByNameResult();
DocInfoStub.ContentInfo info[] = result.getContentInfo();
System.out.println(info[0].getDDocAuthor());
Here is the new exception.
org.apache.axis2.AxisFault: No address information in EPR, cannot infer
transport
at org.apache.axis2.description.ClientUtils.inferOutTransport(
ClientUtils.java:57)
at org.apache.axis2.client.OperationClient.prepareMessageContext(
OperationClient.java:254)
at org.apache.axis2.description.OutInAxisOperationClient.execute(
OutInAxisOperation.java:160)
at com.stellent.www.docinfo.DocInfoStub.DocInfoByName(DocInfoStub.java
:152)
at com.imagesourceinc.Axis2Test.main(Axis2Test.java:44)
If I comment out this line stub._getServiceClient().setOptions(options);
then I get a timeout exception. Any ideas?
- Tyson
On 1/31/07, tyson magney <[EMAIL PROTECTED]> wrote:
I probably should have stateed this first thing. I did not write the web
services I am trying to call. They are coming from a Java Application
server I am trying to integrate with. I know the web services are running
since I can connect to them through Axis 1.4. Thanks for the suggestion
though.
- Tyson
On 1/31/07, Wang, Hailong (NIH/CIT) [C] <[EMAIL PROTECTED] > wrote:
>
> You maybe did not use the correct target end point:
> http://localhost/stellent/idcplg/. Did you get your web service server
> running? If you deployed Axis2 into Tomcat, the target end point should be
> like http://localhost:8080/axis2/services/yourwebservice .
>
>
>
> Hailong
>
>
> ------------------------------
>
> *From:* tyson magney [mailto:[EMAIL PROTECTED]
> *Sent:* Wednesday, January 31, 2007 12:06 PM
> *To:* [email protected]
> *Subject:* Authentication Issue
>
>
>
> Hello,
>
> I am in the process of evaluating Soap toolkits. Axis2 looks promising
> but I am having an issue setting up a test client. I have successfully run
> the WSDL2Java Eclipse plugin to create my stub class. I wrote some client
> code to connect to my web services but it throws an exception. Here is the
> code.
>
> DocInfoStub stub = null;
> stub = new DocInfoStub("http://localhost/stellent/idcplg/"); <-- Fatal
> error here.
> DocInfoStub.DocInfoByName request = new DocInfoStub.DocInfoByName();
> request.setDDocName("000107");
> DocInfoStub.DocInfoByNameResponse response = stub.DocInfoByName
> (request);
>
> Here is the fatal exception when I try to instanciate the DocInfoStub
> class.
> java.lang.ExceptionInInitializerError
> at org.apache.axis2.deployment.DescriptionBuilder.buildOM(
> DescriptionBuilder.java:86)
> at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(
> AxisConfigBuilder.java :58)
> at
> org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(
> DeploymentEngine.java:690)
> at
> org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(
> FileSystemConfigurator.java :109)
> at
>
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext
> (ConfigurationContextFactory.java:61)
> at
>
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(
> ConfigurationContextFactory.java:180)
> at org.apache.axis2.client.ServiceClient.initializeTransports(
> ServiceClient.java:189)
> at org.apache.axis2.client.ServiceClient.configureServiceClient(
> ServiceClient.java :118)
> at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java
> :114)
> at com.stellent.www.docinfo.DocInfoStub.<init>(DocInfoStub.java:82)
> at com.stellent.www.docinfo.DocInfoStub.<init>( DocInfoStub.java
> :106)
> at com.imagesourceinc.Axis2Test.main(Axis2Test.java:31)
> Caused by: java.lang.IllegalStateException: No valid ObjectCreator
> found.
> at org.apache.axiom.om.util.StAXUtils$Pool.<init>( StAXUtils.java
> :41)
> at org.apache.axiom.om.util.StAXUtils.<clinit>(StAXUtils.java:62)
> ... 12 more
> Exception in thread "main"
>
> I believe the issue is that I need to authenticate the webservice. I
> tried using an endpoint URL like "
> http://sysadmin:[EMAIL PROTECTED]/stellent/idcplg/" but it didnt help. I
> added an Authenticator and Options object based on the Http Authentication
> example on the Axis2 site but it did not work either. However the
> documentation does not explain how to add the options to a client stub
> class. The same exception results either way. In Axis 1.4, when I did
> not authenticate properly I received a 401 Http response.
>
> DocInfoStub stub = null;
> //new code
> Options options = new Options();
> HttpTransportProperties.Authenticator auth = new
> HttpTransportProperties.Authenticator ();
> auth.setUsername("sysadmin");
> auth.setPassword("idc");
> options.setProperty(HttpTransportProperties.Authenticator.BASIC, auth);
> //end new code
> stub = new DocInfoStub(" http://localhost/stellent/idcplg/"); <-- Fatal
> error here.
> DocInfoStub.DocInfoByName request = new DocInfoStub.DocInfoByName();
> request.setDDocName("000107");
> DocInfoStub.DocInfoByNameResponse response = stub.DocInfoByName
> (request);
>
> Any help is appreciated. Thanks.
>
> - Tyson
>