WrapperBeanGenerator中的错误:未为类型创建ASM类型

时间:2014-09-05 14:53:23

标签: java linux web-services soap copy

我尝试使用复制Web服务客户端在Linux服务器上检索soap对象。但是我一直在下面得到这个错误跟踪:

java.lang.IllegalArgumentException: Not creating ASM Type for type = byte[]
at                  com.sun.xml.internal.ws.model.WrapperBeanGenerator.getASMType(WrapperBeanGenerator.java:434)
at com.sun.xml.internal.ws.model.WrapperBeanGenerator.collectRequestWrapperMembers(WrapperBeanGenerator.java:297)
at com.sun.xml.internal.ws.model.WrapperBeanGenerator.createRequestWrapperBean(WrapperBeanGenerator.java:239)
at com.sun.xml.internal.ws.model.RuntimeModeler.getRequestWrapperClass(RuntimeModeler.java:279)
at com.sun.xml.internal.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:673)
at com.sun.xml.internal.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:611)
at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:400)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:239)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:710)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:698)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:313)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:295)
at javax.xml.ws.Service.getPort(Service.java:112)
at actuals.com.microsoft.sharepoint.webservices.Copy.getCopySoap(Copy.java:56)

以下是正在运行的代码:

public CopySoap getCopySoap() throws Exception {
    System.out.println("Creating a CopySoap instance...");
    Copy service = new Copy(new URL("https://ts.kompany.com/sites/Global/_vti_bin/Copy.asmx?wsdl"),
            new QName("http://schemas.microsoft.com/sharepoint/soap/", "Copy"));
    CopySoap copySoap = service.getCopySoap();
    BindingProvider bp = (BindingProvider) copySoap;
    bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, userName);
    bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://ts.kompany.com/sites/Global/_vti_bin/Copy.asmx");
    System.out.println(BindingProvider.USERNAME_PROPERTY.getBytes()+""+ BindingProvider.PASSWORD_PROPERTY.getBytes());
    return copySoap;
}

它失败了:

CopySoap copySoap = service.getCopySoap();

CopySoap类如下:

package actuals.com.microsoft.sharepoint.webservices;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.Holder;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;


/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.1.6 in JDK 6
 * Generated source version: 2.1
 * 
 */
@WebService(name = "CopySoap", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/")
@XmlSeeAlso({
    ObjectFactory.class
})
public interface CopySoap {


    /**
     * 
     * @param results
     * @param copyIntoItemsLocalResult
     * @param sourceUrl
     * @param destinationUrls
     */
    @WebMethod(operationName = "CopyIntoItemsLocal", action = "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItemsLocal")
    @RequestWrapper(localName = "CopyIntoItemsLocal", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", className = "com.microsoft.sharepoint.webservices.CopyIntoItemsLocal")
    @ResponseWrapper(localName = "CopyIntoItemsLocalResponse", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", className = "com.microsoft.sharepoint.webservices.CopyIntoItemsLocalResponse")
    public void copyIntoItemsLocal(
        @WebParam(name = "SourceUrl", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/")
        String sourceUrl,
        @WebParam(name = "DestinationUrls", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/")
        DestinationUrlCollection destinationUrls,
        @WebParam(name = "CopyIntoItemsLocalResult", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", mode = WebParam.Mode.OUT)
        Holder<Long> copyIntoItemsLocalResult,
        @WebParam(name = "Results", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", mode = WebParam.Mode.OUT)
        Holder<CopyResultCollection> results);

    /**
     * 
     * @param stream
     * @param results
     * @param copyIntoItemsResult
     * @param sourceUrl
     * @param destinationUrls
     * @param fields
     */
    @WebMethod(operationName = "CopyIntoItems", action = "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems")
    @RequestWrapper(localName = "CopyIntoItems", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", className = "com.microsoft.sharepoint.webservices.CopyIntoItems")
    @ResponseWrapper(localName = "CopyIntoItemsResponse", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", className = "com.microsoft.sharepoint.webservices.CopyIntoItemsResponse")
    public void copyIntoItems(
        @WebParam(name = "SourceUrl", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/")
        String sourceUrl,
        @WebParam(name = "DestinationUrls", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/")
        DestinationUrlCollection destinationUrls,
        @WebParam(name = "Fields", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/")
        FieldInformationCollection fields,
        @WebParam(name = "Stream", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/")
        byte[] stream,
        @WebParam(name = "CopyIntoItemsResult", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", mode = WebParam.Mode.OUT)
        Holder<Long> copyIntoItemsResult,
        @WebParam(name = "Results", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", mode = WebParam.Mode.OUT)
        Holder<CopyResultCollection> results);

    /**
     * 
     * @param getItemResult
     * @param stream
     * @param url
     * @param fields
     */
    @WebMethod(operationName = "GetItem", action = "http://schemas.microsoft.com/sharepoint/soap/GetItem")
    @RequestWrapper(localName = "GetItem", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", className = "com.microsoft.sharepoint.webservices.GetItem")
    @ResponseWrapper(localName = "GetItemResponse", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", className = "com.microsoft.sharepoint.webservices.GetItemResponse")
    public void getItem(
        @WebParam(name = "Url", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/")
        String url,
        @WebParam(name = "GetItemResult", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", mode = WebParam.Mode.OUT)
        Holder<Long> getItemResult,
        @WebParam(name = "Fields", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", mode = WebParam.Mode.OUT)
        Holder<FieldInformationCollection> fields,
        @WebParam(name = "Stream", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", mode = WebParam.Mode.OUT)
        Holder<byte[]> stream);

}

当我在Windows 7上的Eclipse本地运行时,我的代码工作正常,但在Linux服务器上,它给了我这个错误。有谁知道这意味着什么或我如何解决这个错误?

1 个答案:

答案 0 :(得分:0)

解决方案应该是在Linux机器上切换到不同的Java版本:

我遇到了完全相同的问题(在Windows 7上执行/在Linux上执行,同样的错误堆栈跟踪)。

在我的Linux服务器上,我正在使用&#34; JDK 1.6.0_22-b04&#34;我发现标准java库里面似乎有一个bug&#34; rt.jar&#34;。切换到&#34; JDK 1.7.0_51-b03&#34;后,它运行了。