axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Fremantle" <pzf...@gmail.com>
Subject Re: Sharepoint Web services
Date Mon, 05 Nov 2007 15:36:36 GMT
When Axis2 creates a stub, it hard codes the URL that is in the WSDL into
the stub as the default, but you can modify this at runtime. It seems like
the URL contained in the WSDL for the server is not valid so the
"hard-coded" service URL won't work.

So you need to pass the real service URL to Axis2 when you use the
constructor:

                   WebsStub stub = new WebsStub("
http://server/_vti_bin/Webs.asmx");

Paul

On 11/5/07, Das, Amar <amar.das@fmr.com> wrote:
>
> Hi:
>
> I generated Java code using wsdl2java for Microsoft sharepoint web
> services http://server/_vti_bin/Webs.asmx.  I am trying to execute the
> GetWebCollection methods using the following code.
>
> <code>
> public class TestShare {
>         public static void main(String[] args) {
>                 try {
>                         WebsStub stub = new WebsStub();
>
>                         // setup NTLM auth
>                         HttpTransportProperties.Authenticator auth = new
> HttpTransportProperties.Authenticator();
>                         auth.setDomain("x");
>                         auth.setUsername("x");
>                         auth.setPassword("x");
>                         auth.setHost("x");
>                         ArrayList<String> authSchemes = new
> ArrayList<String>();
>
> authSchemes.add(HttpTransportProperties.Authenticator.NTLM);
>                         auth.setAuthSchemes(authSchemes);
>
>                         Options options = new Options();
>                         options.setProperty(HTTPConstants.AUTHENTICATE,
> auth);
>
>                         ServiceClient serviceClient =
> stub._getServiceClient();
>                         serviceClient.setOptions(options);
>
>                         // set NTLM auth
>                         serviceClient.getOptions().setProperty(
>
> org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
>                                         auth);
>
>                         GetWebCollection wc = new
> WebsStub.GetWebCollection();
>                         stub.GetWebCollection(wc);
>
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                 }
>         }
> }
> </code>
>
> I am receiving the following error.  What am I doing wrong?
> org.apache.axis2.AxisFault: Address information does not exist in the
> Endpoint Reference (EPR).The system cannot infer the transport
> mechanism.
>         at
> org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.j
> ava:65)
>         at
> org.apache.axis2.client.OperationClient.prepareMessageContext(OperationC
> lient.java:302)
>         at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInA
> xisOperation.java:174)
>         at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163
> )
>         at
> com.microsoft.schemas.sharepoint.soap.WebsStub.GetWeb(WebsStub.java:1054
> )
>         at ftg.ops.eas.ps.TestShare.main(TestShare.java:45)
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

Mime
View raw message