SOAP 요청에 첨부 파일을 추가하는 방법에 관해서 느슨한 편입니다. 우리는 자바로 제작 된 타드 파티 웹 서비스를 소비해야하는데, 이것은 내가 접하게 된 가장 복잡한 일이다. 첨부 파일을 필요로하는 다른 웹 서비스에는 첨부 파일을 추가 할 수있는 메소드 나 속성이 있습니다. 단순한. 그러나이 방법은 제공하지 않습니다.SOAP 요청에 첨부 파일 추가하기
SOAP 메시지의 버전은 정확히 XML을 원했지만 우리가 추가 할 수없는 파일의 MIME 부분입니다.
예 : XML 전에
:
우리처럼 거기에 MIME 부분을 필요로하는<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<soap:Header>
<payloadManifest xmlns="http://<examplePayload>">
<manifest contentID="Content0" namespaceURI="http://<exampleManifest>" element="ProcessRepairOrder" version="2.01" />
</payloadManifest>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>2011-12-19T15:25:13Z</wsu:Created>
<wsu:Expires>2011-12-19T15:30:00Z</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken><wsse:Username>username</wsse:Username><wsse:Password>password</wsse:Password></wsse:UsernameToken></wsse:Security></soap:Header><soap:Body><ProcessMessage xmlns="<examplePayload"><payload><content id="Content0">
<s:ProcessRepairOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://example.xsd" xmlns:s="http://<exampleManifest>" xmlns:gwm="http://example">
<s:ApplicationArea>
<s:Sender>
<s:Component>Test</s:Component>
<s:Task>ProcessAttachment</s:Task>
<s:CreatorNameCode>Test</s:CreatorNameCode>
<s:SenderNameCode>XX</s:SenderNameCode>
<s:DealerNumber>111111</s:DealerNumber>
<s:DealerCountry>GB</s:DealerCountry>
</s:Sender>
<s:CreationDateTime>2010-03-26T13:37:05Z</s:CreationDateTime>
<s:Destination>
<s:DestinationNameCode>GM</s:DestinationNameCode>
<s:DestinationURI/>
<s:DestinationSoftwareCode>GWM</s:DestinationSoftwareCode>
</s:Destination>
</s:ApplicationArea>
<s:DataArea xsi:type="gwm:DataAreaExtended">
<s:Process/>
<s:RepairOrder>
<s:Header xsi:type="gwm:RepairOrderHeaderExtended">
<s:DocumentId/>
</s:Header>
<s:Job xsi:type="gwm:JobExtended">
<s:JobNumber/>
<s:OperationId>Test</s:OperationId>
<s:OperationName/>
<s:CodesAndComments/>
<s:Diagnostics/>
<s:WarrantyClaim xsi:type="gwm:WarrantyClaimExtended">
<s:OEMClaimNumber>00112233445566778899</s:OEMClaimNumber>
<gwm:Attachment>
<gwm:File><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:test.gif"/></gwm:File>
<gwm:Filename>test.gif</gwm:Filename>
</gwm:Attachment>
</s:WarrantyClaim>
<s:LaborActualHours>0.0</s:LaborActualHours>
<s:Technician/>
</s:Job>
</s:RepairOrder>
</s:DataArea>
</s:ProcessRepairOrder>
</content></payload></ProcessMessage></soap:Body></soap:Envelope>
이것은 우리가 생성하고 배웅 할 수있는 XML 부분입니다, 그러나 그것은 잘못된 것입니다 XML 후
--MIMEBoundary
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <rootpart>
--MIMEBoundary
Content-Type: image/gif; name=test.gif
Content-Transfer-Encoding: binary
Content-ID: <test.gif>
[email protected]�
--MIMEBoundary--
나는 인터넷을 해답을 찾았지만 아무 것도 나오지 않았다. 이를 위해 WSE를 사용하는 것에 관한 많은 문서가없는 것 같습니다. 나는 WSE가 서버 측의 요구 사항이라는 것을 강조해야하며,이 문제를 해결하기 위해 기술을 변경할 수있는 방법은 없습니다.
이러한 MIME 섹션을 추가 할 수있는 방법이 있습니까?
편집 : 첨부 파일이 포함 된 SoapUI를 통해 작동하는 XML 문서를 가져올 수는 있지만, 코드 내에서 길을 찾지 못하는 것 같습니다.
나는이 문제에 대한 해결책을 얻기 위해 현상금을 추가했다. 누군가 다른 아이디어가 있다면 알려주세요.
EDIT again : 나는 여기에서 응답을 확인할 수 있었으므로 1 주일이 지난 것을 알고 있지만, 어떤 사람들은 내가 어디에서 볼 것인가에 대해 좋은 아이디어를 준다. 아직 공백을 그리는 중이다. XopDocument
과 그 방법을 둘러싼 끔찍한 문서는 큰 단점이 있습니다. 누구든지 SaveToXopPackage
을 사용하는 사례가 있다면 화를 내기 시작합니다.
WSE는 더 이상 사용되지 않으므로 사용하지 않아야합니다. –
글쎄요, John, 당신은 모든 것을 알고있는 것만으로 돌아 다니는 것보다는 해결 방법을 제안하는 것이 어떻습니까? 이 시나리오에서는 저에게 WSE가 필요합니다. 그것 없이는 우리의 요청이 거절 될 것입니다. 타사 공급 업체에게 코딩 방법을 알릴 수는 없지만 시도 할 수는 있지만 항상 세상에서 가장 도움이되지 않는 회사입니다. 따라서 WSE는 자체 소프트웨어를 만드는 경우에는 사용하지 말아야하지만이 경우에는 WSE가 필요합니다. – anothershrubery
분명히 회사가 구식 소프트웨어를 사용해야하는 제 3 자와 비즈니스를 계속해야하는지 여부와 그렇지 않은 경쟁자에 대한 비즈니스 결정입니다. –