1

SOAP 웹 서비스를 호출하는 클라이언트를 작성해야합니다. 나는 wsdlSOAP request을 받았습니다. 이것은 보안 웹 서비스이며 첨부 파일이 서비스로 전달되는 파일입니다. 나는 SOAP UI을 사용하여 테스트했지만 Java 프로그램을 작성하여 서비스를 호출해야합니다. 여기 보안 SOAP 웹 서비스에 파일 보내기

는 WSDL

<definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://xmlns.oracle.com/integration/b2b" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="WS_VT_SECURED_INBOUND" targetNamespace="http://xmlns.oracle.com/integration/b2b"> 
<types> 
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/integration/b2b"> 
<element name="TransportFileRequest"> 
<complexType> 
<sequence> 
<element minOccurs="1" name="FileName" type="string"/> 
<element minOccurs="1" name="FileType" type="string"/> 
<element maxOccurs="1" minOccurs="1" name="messageID" type="string"/> 
<element maxOccurs="1" minOccurs="1" name="senderID" type="string"/> 
<element maxOccurs="1" minOccurs="1" name="checksum" type="string"/> 
<element maxOccurs="1" minOccurs="1" name="timestamp" type="string"/> 
<element maxOccurs="1" minOccurs="1" name="transportVersion" type="string"/> 
<element maxOccurs="1" minOccurs="1" name="payload" type="anyType"/> 
</sequence> 
</complexType> 
</element> 
<element name="TransportFileResponse"> 
<complexType> 
<sequence> 
<element maxOccurs="1" minOccurs="1" name="Status" type="string"/> 
<element maxOccurs="unbounded" minOccurs="0" name="ErrorMessage" type="string"/> 
</sequence> 
</complexType> 
</element> 
<element name="error" type="string"/> 
</schema> 
</types> 
<message name="TransportFileResponseMessage"> 
<part name="FileTransportResponse" element="tns:TransportFileResponse"></part> 
</message> 
<message name="faultMessage"> 
<part name="faultMessage" element="tns:error"></part> 
</message> 
<message name="TransportFileRequestMessage"> 
<part name="FileTransportRequest" element="tns:TransportFileRequest"></part> 
</message> 
<portType name="TransportFilePort"> 
<operation name="sendFile"> 
<input message="tns:TransportFileRequestMessage"></input> 
<output message="tns:TransportFileResponseMessage"></output> 
<fault name="faultMessage" message="tns:faultMessage"></fault> 
</operation> 
</portType> 
<binding name="TransportFilePortBinding" type="tns:TransportFilePort"> 
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> 
<operation name="sendFile"> 
<soap:operation soapAction="sendFile" style="document"/> 
<input> 
<soap:body use="literal"/> 
</input> 
<output> 
<soap:body use="literal"/> 
</output> 
<fault name="faultMessage"> 
<soap:fault name="faultMessage" use="literal"/> 
</fault> 
</operation> 
</binding> 
<service name="receiveFile_WS_VT_SECURED_INBOUND"> 
<port name="TransportFilePort_pt" binding="tns:TransportFilePortBinding"> 
<soap:address location="https://hostname:9443/wsx/services/receiveFile_WS_VT_SECURED_INBOUND"/> 
</port> 
</service> 
</definitions> 

입니다 그리고 이것은 위의 첨부 파일에서

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:b2b="http://xmlns.oracle.com/integration/b2b"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <b2b:TransportFileRequest> 
      <b2b:FileName>120_VERMONT_ACH_Sanity11march1.dat</b2b:FileName> 
     <b2b:FileType>120</b2b:FileType> 
     <b2b:MessageID>3454</b2b:MessageID> 
     <b2b:SenderID>ekrjekrj</b2b:SenderID> 
     <b2b:checksum>b2ee8af554ab6933085d341b71765bc8</b2b:checksum> 
     <b2b:timestamp>3434</b2b:timestamp> 
     <b2b:transportServiceVersion>4343</b2b:transportServiceVersion> 
     <b2b:payload>120_VERMONT_ACH_Sanity11march1.dat</b2b:payload> 
     </b2b:TransportFileRequest> 
    </soapenv:Body> 
</soapenv:Envelope> 

가 여러 개의있을 수 있습니다 알고

<b2b:payload>120_VERMONT_ACH_Sanity11march1.dat</b2b:payload> 

처럼 SOAP 요청이 보이는 것입니다 그 방법은 apache http client 라이브러리 또는 다른 것을 사용하는 것과 같습니다. 하지만 나는 웹 서비스로 일한 적이 없으므로 그것에 대해 많이 알지 못한다. 비록 내가 아파치 http 클라이언트와 함께 시작했지만 그것을 할 수 없습니다. 아파치 문제에 대해서는 하나의 질문을 게시했습니다 Sending file to secured SOAP web service using apache http client하지만 지금까지는 해결책이 없습니다. apache http 클라이언트를 사용하여 동일한 작업을 수행해야한다는 강요는 없습니다.

내가 어떻게 할 수 있는지 알려 주시기 바랍니다.

답변

0

Axis 또는 CXF과 같은 JAX-WS 호환 프레임 워크를 사용하고 하향식 방식을 따르십시오.

이러한 프레임 워크는 WSDL에서 시작하여 적절한 Java 클라이언트 클래스를 생성하는 데 도움이되는 도구를 제공합니다.

HTTP 클라이언트를 사용하려면 java.xml.soap의 클래스를 사용하여 SOAP 봉투를 직접 처리해야합니다. SOAPMessage

을 참조하십시오.
관련 문제