You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Bill Klish <bk...@gmail.com> on 2008/02/11 23:27:07 UTC

Axis 1.4 call works, same call fails in Axis2

I have auto generated an Axis 1.4 and Axis2 (adb binding) against a web
service.  I used the same WSDL to auto generate both of these classes in
Eclipse 3.3, using JDK 1.4.2_13.  The web service is written in .Net and is
being served up by IIS.

The following method works in 1.4

            MediaBinServerSoap service = locator
                    .getMediaBinServerSoap(new URL(
                            "
http://myserver.com:80/MediaBinWebService/MediaBinServer.asmx?WSDL<http://myserver.com/MediaBinWebService/MediaBinServer.asmx?WSDL>
"));
            ((Stub) service).setUsername("user");
            ((Stub) service).setPassword("password");

            MBMetadata[] customMetadata = service.getEditableMetadata();
            for (int index = 0; index < customMetadata.length; index++) {
                System.out.println(customMetadata[index].getMID() + " - " +
customMetadata[index].getMName());
            }


but fails in Axis2.

            MediaBinServerStub service = new MediaBinServerStub(
                    "
http://myserver.com:80/MediaBinWebService/MediaBinServer.asmx?WSDL<http://myserver.com/MediaBinWebService/MediaBinServer.asmx?WSDL>
");

            Options options = service._getServiceClient().getOptions();

            HttpTransportProperties.Authenticator auth = new
HttpTransportProperties.Authenticator();
            auth.setUsername("user");
            auth.setPassword("password");
            auth.setPreemptiveAuthentication(true);
            auth.setDomain("HQ");
            auth.setHost("myserver.com");

            options.setProperty(HTTPConstants.AUTHENTICATE, auth);

            MediaBinServerStub.GetEditableMetadata req = new
MediaBinServerStub.GetEditableMetadata();
            GetEditableMetadataResponse response =
service.GetEditableMetadata(req);
            MBMetadata[] customMetadata = response
                    .getGetEditableMetadataResult().getMBMetadata();
            for (int index = 0; index < customMetadata.length; index++) {
                System.out.println(customMetadata[index].getMID() + " - "
                        + customMetadata[index].getMName());
            }

com.ctc.wstx.exc.WstxParsingException: Expected a text token, got
START_ELEMENT.
 at [row,col {unknown-source}]: [1,829]

    at com.mediabin.www.MediaBinServerStub$MBMetadataFormat$Factory.parse(
MediaBinServerStub.java:7312)
    at com.mediabin.www.MediaBinServerStub$MBMetadata$Factory.parse(
MediaBinServerStub.java:4674)
    at com.mediabin.www.MediaBinServerStub$ArrayOfMBMetadata$Factory.parse(
MediaBinServerStub.java:32201)
    at
com.mediabin.www.MediaBinServerStub$GetEditableMetadataResponse$Factory.parse
(MediaBinServerStub.java:52865)
    at com.mediabin.www.MediaBinServerStub.fromOM(MediaBinServerStub.java
:49469)


I turned log4j to trace level and it appears that the response is somehow
being truncated.  There should be 68 metadata values returned, but only 3
are being output before the response is closed.

Is there some sort of setting I need to turn on for this or something else
that is obviously incorrect?