Java 连接wsdl函数时出现Soap Api问题

Java 连接wsdl函数时出现Soap Api问题,java,spring-boot,soap,Java,Spring Boot,Soap,我在将soap API与我的spring boot应用程序连接时遇到问题,我们已经从一家电信公司购买了服务,该公司为我们提供了soap API,我正试图通过该API发送SMS。但是我不能做到这一点,因为SpringBoot没有重新组织我的URL。我已经花了两天的时间,做了所有的事情,但除了失败什么都没有。请帮我解决这个问题。由于我不熟悉java中的SOAP API,所以我很难连接和理解它 以下是我的WSDL URL: 我只需要使用其中的QuickMs函数,我正在尝试这样做

我在将soap API与我的spring boot应用程序连接时遇到问题,我们已经从一家电信公司购买了服务,该公司为我们提供了soap API,我正试图通过该API发送SMS。但是我不能做到这一点,因为SpringBoot没有重新组织我的URL。我已经花了两天的时间,做了所有的事情,但除了失败什么都没有。请帮我解决这个问题。由于我不熟悉java中的SOAP API,所以我很难连接和理解它

以下是我的WSDL URL: 我只需要使用其中的QuickMs函数,我正在尝试这样做

            URL url = null;
            URLConnection connection = null;
            HttpURLConnection httpConn = null;
            String responseString = null;
            String outputString="";
            OutputStream out = null;
            InputStreamReader isr = null;
            BufferedReader in = null;

            String xmlInput =  "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\" xmlns:cbs=\"http://schemas.datacontract.org/2004/07/CBSCustomerAPI\"> <soapenv:Header/> <soapenv:Body> <tem:QuickSMS> <tem:obj_QuickSMS> <cbs:loginId>LOGINID</cbs:loginId> <cbs:loginPassword>PASSWORD</cbs:loginPassword> <cbs:Destination>923452785722</cbs:Destination> <cbs:Mask>8655</cbs:Mask> <cbs:Message>Test</cbs:Message> <cbs:UniCode>1</cbs:UniCode> <cbs:ShortCodePrefered>N</cbs:ShortCodePrefered> </tem:obj_QuickSMS> </tem:QuickSMS> </soapenv:Body> </soapenv:Envelope>";

            try
            {
                url = new URL(wsURL);
                connection = url.openConnection();
                httpConn = (HttpURLConnection) connection;

                byte[] buffer = new byte[xmlInput.length()];
                buffer = xmlInput.getBytes();

                String SOAPAction = "";
                // Set the appropriate HTTP parameters.
                httpConn.setRequestProperty("Content-Length", String
                        .valueOf(buffer.length));
                httpConn.setRequestProperty("Content-Type",
                        "text/xml; charset=utf-8");


               // httpConn.setRequestProperty("SOAPAction", SOAPAction);
                httpConn.setRequestMethod("POST");
                httpConn.setDoOutput(true);
                httpConn.setDoInput(true);
                out = httpConn.getOutputStream();
                out.write(buffer);
                out.close();

                // Read the response and write it to standard out.
                isr = new InputStreamReader(httpConn.getInputStream());
                in = new BufferedReader(isr);

                while ((responseString = in.readLine()) != null)
                {
                    outputString = outputString + responseString;
                }
                System.out.println(outputString);
                System.out.println("");

                // Get the response from the web service call
                Document document = parseXmlFile(outputString);

                NodeList nodeLst = document.getElementsByTagName("ns2:sayhelloResponse");
                String webServiceResponse = nodeLst.item(0).getTextContent();
                System.out.println("The response from the web service call is : " + webServiceResponse);
URL=null;
URLConnection=null;
HttpURLConnection httpConn=null;
字符串responseString=null;
字符串outputString=“”;
OutputStream out=null;
InputStreamReader isr=null;
BufferedReader in=null;
字符串xmlInput=“LOGINID密码923452785722 8655测试1 N”;
尝试
{
url=新url(wsURL);
connection=url.openConnection();
httpConn=(HttpURLConnection)连接;
byte[]buffer=新字节[xmlInput.length()];
buffer=xmlInput.getBytes();
字符串SOAPAction=“”;
//设置适当的HTTP参数。
httpConn.setRequestProperty(“内容长度”,字符串
.valueOf(缓冲区长度));
httpConn.setRequestProperty(“内容类型”,
“text/xml;charset=utf-8”);
//httpConn.setRequestProperty(“SOAPAction”,SOAPAction);
httpConn.setRequestMethod(“POST”);
httpConn.setDoOutput(真);
httpConn.setDoInput(真);
out=httpConn.getOutputStream();
输出。写入(缓冲区);
out.close();
//读取响应并将其写入标准输出。
isr=新的InputStreamReader(httpConn.getInputStream());
in=新的缓冲读取器(isr);
while((responseString=in.readLine())!=null)
{
outputString=outputString+responseString;
}
System.out.println(outputString);
System.out.println(“”);
//从web服务调用获取响应
Document Document=parseXmlFile(outputString);
NodeList nodeLst=document.getElementsByTagName(“ns2:sayhelloResponse”);
字符串webServiceResponse=nodeLst.item(0.getTextContent();
System.out.println(“来自web服务调用的响应是:“+webServiceResponse”);
但它给了我IOEXCEPTION java.io.IOEXCEPTION:服务器返回的HTTP响应代码:500,用于URL:

我的问题或解决方案是什么?