Soap Webservice将其WSDL定义作为响应发送

Soap Webservice将其WSDL定义作为响应发送,soap,wsdl,jax-ws,Soap,Wsdl,Jax Ws,我向Web服务发送SOAP请求,但它将其WSDL定义作为响应发送回去 什么会导致这种情况 答复: <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.sample.com/test_request" xmlns:mime="http://schemas.xmlsoap.or

我向Web服务发送SOAP请求,但它将其WSDL定义作为响应发送回去

什么会导致这种情况

答复:

<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.sample.com/test_request" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.sample.com/test_request" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      <wsdl:types>
        <xsd:schema e
是什么导致了这个问题?
我从您在URL中指定的用于获取WSDL(参数?WSDL)的SOAP UI得到了正确的响应。您需要为要调用的服务操作指定正确的URL。

很可能是您的SOAP请求和/或端点配置。不完整的回答对回答您的问题没有帮助。请为您的请求显示代码。@Filburt添加了更新。我从哪里可以获得更新?您必须询问服务提供商。您可以尝试访问upto.com,然后留下东西。
import javax.xml.soap.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;

public class Test {

    /**
     * Starting point for the SAAJ - SOAP Client Testing
     */
    public static void main(String args[]) {
        try {
            // Create SOAP Connection
            SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
            SOAPConnection soapConnection = soapConnectionFactory.createConnection();

            // Send SOAP Message to SOAP Server
            String url = "https://xxxxxxxxxxx.xxxxxxxxx.com/xxxxxxxx.do?WSDL&xxxxxxxxx=qualified";
            SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);

            // Process the SOAP Response
            printSOAPResponse(soapResponse);

            soapConnection.close();
        } catch (Exception e) {
            System.err.println("Error occurred while sending SOAP Request to Server");
            e.printStackTrace();
        }
    }

    private static SOAPMessage createSOAPRequest() throws Exception {
        MessageFactory messageFactory = MessageFactory.newInstance();
        SOAPMessage soapMessage = messageFactory.createMessage();
        SOAPPart soapPart = soapMessage.getSOAPPart();

        String serverURI = "http://www.xxxxxxxx.com/xxxxxx";

        // SOAP Envelope
        SOAPEnvelope envelope = soapPart.getEnvelope();
        envelope.addNamespaceDeclaration("a", "http://www.xxxxxxw.com/xxxxxxxx");

        // SOAP Body
        SOAPBody soapBody = envelope.getBody();
        SOAPElement soapBodyElem = soapBody.addChildElement("test", "a");
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("testid", "a");
        soapBodyElem1.addTextNode("xxxxxxxxx");

        MimeHeaders headers = soapMessage.getMimeHeaders();
        headers.addHeader("SOAPAction", "http://www.xxxxxx-xxxxx.com/xxxxxxx/xxxx");


        String username = "123";
        String password = "123";
        String authorization = new sun.misc.BASE64Encoder().encode((username + ":" + password).getBytes());
        System.out.println(authorization);
        headers.addHeader("Authorization", "Basic " + authorization);

        headers.addHeader("Proxy-Connection","Keep-Alive");


        soapMessage.saveChanges();

        /* Print the request message */
        System.out.println("Request: ");
        soapMessage.writeTo(System.out);
        System.out.println();

        return soapMessage;
    }

    /**
     * Method used to print the SOAP Response
     */
    private static void printSOAPResponse(SOAPMessage soapResponse) throws Exception {
        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer = transformerFactory.newTransformer();
        Source sourceContent = soapResponse.getSOAPPart().getContent();
         System.out.print("\nResponse SOAP Message = ");
        StreamResult result = new StreamResult(System.out);
        transformer.transform(sourceContent, result);
    }

}