cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Visual Studio SOAP client in C#, fetchAttachments web service problem

amatei
12-Amethyst

Visual Studio SOAP client in C#, fetchAttachments web service problem

Hello,

I am using Visual Studio and C# to create a SOAP client for Integrity 10.8  web services

The wizard generated a class public partial class Integrity_10_2Service : System.Web.Services.Protocols.SoapHttpClientProtocol

I use the code below to get the attached file from an item.

               Integrity_10_2Service ws = new Integrity_10_2Service();

                ws.Url = "http://server:port/webservices/10/2/Integrity/";


                AttachmentRequest arg0 = new AttachmentRequest();
                arg0.AttachmentName = "Workflow.png";
                arg0.FieldName = "Attachments";
                arg0.ItemId = 123456;
                arg0.Username = "my_username";
                arg0.Password = "my_password";

                fetchAttachments fa= new fetchAttachments();
                fa.arg0 = arg0;

                fetchAttachmentsResponse response = ws.fetchAttachments(fa);

The response of the fetchAttachments method is this:

System.InvalidOperationException: Client found response content type of 'multipart/related; type="application/xop+xml"; start="<rootpart@ws.jboss.org>"; start-info="text/xml"; boundary="----=_Part_2_393602499. 1494413207524"', but expected 'text/xml'.
The request failed with the error message:
--

------=_Part_2_393602499. 1494413207524
Content-Type: application/xop+xml; type="text/xml"
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart@ws.jboss.org>

<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns3:fetchAttachmentsResponse xmlns:ns1="http://webservice.mks.com/10/2/Integrity/schema" xmlns:ns3="http://webservice.mks.com/10/2/Integrity"><return><ns1:Attachment><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:Attachment-12b4e7d1-754-404d-a426-34c99087fd59@ws.jboss.org"/></ns1:Attachment></return></ns3:fetchAttachmentsResponse></env:Body></env:Envelope>
------=_Part_2_393602499. 1494413207524
Content-Type: image/png
Content-Transfer-Encoding: binary
Content-Id: <Attachment-12b4e7d1-754-404d-a426-34c99087fd59@ws.jboss.org>

?PNG

Can someone help ? Thank you.

I mention that the web service works correctly, I tested it with SoapUI and also by creating a SOAP client in Java (Developing JAX-WS Web Service Clients - NetBeans IDE Tutorial)

In the C# SOAP client I see the problem described above.

I've noticed there is a C# WCF client topic here with a different error message

https://www.ptcusercommunity.com/thread/59859

I am interested in a solution for C# SOAP clients not for C# WCF clients

0 REPLIES 0
Top Tags