通过soapconnection发送xml时出现异常

cgvd09ve  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(306)

我试图通过soap连接发送xml,在运行时收到此异常。这是什么意思。为什么我会得到这个例外。异常从webserviceproxy.java中的第126行开始。我不确定应该检查什么来解决此异常。让我知道更多的信息。

com.ibm.ws.webservices.engine.PivotHandlerWrapper bindExceptionToResponse
    SEVERE: WSWS3400I: Info: unexpected exception.
   java.lang.NoClassDefFoundError: com.ibm.ws.runtime.component.ComponentImpl
    at java.lang.ClassLoader.defineClassImpl(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:222)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:148)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:556)
    at java.net.URLClassLoader.access$400(URLClassLoader.java:119)
    at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:961)
    at java.security.AccessController.doPrivileged(AccessController.java:274)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:487)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:604)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:327)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:561)
    at com.ibm.ws.webservices.engine.components.net.JSSESocketFactory.create(JSSESocketFactory.java:162)
    at com.ibm.ws.webservices.engine.transport.http.HTTP11Sender$5.run(HTTP11Sender.java:1789)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:111)
    at com.ibm.ws.webservices.engine.transport.http.HTTP11Sender$SocketPoolFactory.obtainSocket(HTTP11Sender.java:1781)
    at com.ibm.ws.webservices.engine.transport.http.HTTP11Sender.invoke(HTTP11Sender.java:185)
    at com.ibm.ws.webservices.engine.transport.http.HTTPSender.invoke(HTTPSender.java:87)
    at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:212)
    at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:255)
    at com.ibm.ws.webservices.engine.client.Connection.invokeEngine(Connection.java:700)
    at com.ibm.ws.webservices.engine.client.Connection.invoke(Connection.java:626)
    at com.ibm.ws.webservices.engine.client.Connection.invoke(Connection.java:449)
    at com.ibm.ws.webservices.engine.client.Call.invoke(Call.java:1389)
    at com.xxxxx.xx.xxx.xxxxx.xx.xxxxx.xxxxx.xxxx.xxxxxxx.xxxxxxxxx(WebServiceProxy.java:126)

java代码

SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
        SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody();
        SOAPElement rootElement = soapBody.addChildElement(this.operationName,"urn",this.namespace);
        rootElement.addChildElement(se);
        soapMessage.saveChanges();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        soapMessage.writeTo(bos);
        log.debug(ctx,EVENTS.ADHOC,"Request XML :"+ bos.toString());
        SOAPConnectionFactory connectionFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection connection = connectionFactory.createConnection();
        SOAPMessage soapResponse = connection.call(soapMessage, this.targetEndpointAddress);
        ByteArrayOutputStream bos1 = new ByteArrayOutputStream();
        soapMessage.writeTo(bos1);
        log.debug(ctx,EVENTS.ADHOC,"Resposne XML :"+ bos1.toString());
        long startTime = System.currentTimeMillis();
        //Log the response status of service
        ResponseStatus.update(serviceName, (int) (System
                .currentTimeMillis() - startTime));
        SOAPBody body = soapResponse.getSOAPPart().getEnvelope().getBody();
        Iterator itr = body.getChildElements();
        String response = body.toString();
        if (response == null) {
            this.log.debug(ctx,EVENTS.ADHOC," Response is null");
            return "<response>Blank response received</response>";
        } else {
            this.log.debug(ctx,EVENTS.ADHOC," Response XML", response.toString());
        }
        StringBuffer stringBuffer = new StringBuffer();
        if(this.operationName.equalsIgnoreCase("getDataOne")){
             Iterator iterate = body.getChildElements();
             stringBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><tns:xxxxxxx xmlns:tns=\"urn:com.xxx.xx.xxx.xxxxxx.xx.xxxxx.xxxxxxxxxx\">");
             String[] test = (response.toString()).split("<Tag2>");
             stringBuffer.append("<Tag1><Tag2>"); //This is WebServiceProxy.java:126 
             stringBuffer.append(test[1]);

             while (iterate.hasNext()){
                response = iterate.next().toString();
                if(response != null) {
                    test = null;
                    test = (response.toString()).split("<Tag2>");
                    stringBuffer.append("<Tag1><Tag2>");
                    stringBuffer.append(test[1]);

                }

提前谢谢!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题