<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: C# SOAP Client in Systems/Software Engineering</title>
    <link>https://www.ptcusercommunity.com/t5/Systems-Software-Engineering/C-SOAP-Client/m-p/492090#M5651</link>
    <description>&lt;P&gt;I got it to work using the following code:&lt;/P&gt;
&lt;PRE&gt;using integrity;&lt;BR /&gt;&lt;BR /&gt;//onclick event for vsta form button&lt;BR /&gt;public void CTRL12_5_Clicked(object sender, ClickedEventArgs e)
        {
            # region createhttpbinding
            BasicHttpBinding basicHttpbinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
            basicHttpbinding.Name = "BasicHttpBinding_Integrity";
            basicHttpbinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
            basicHttpbinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            EndpointAddress endpointAddress = new EndpointAddress("http://servername:7001/webservices/10/2/Integrity/");
            Integrity_10_2Client proxyClient = new Integrity_10_2Client(basicHttpbinding, endpointAddress);
            #endregion

            //set fields to pull
            string[] inputfields = { 
                        "Title", 
                        "Body",
                        "User", 
                        "Department", 
                        "Priority",
                        "Type"
                                   };

            GetItemType git = new GetItemType();
            git.InputField = inputfields;
            git.ItemId = itemid;
            git.Username = "username";
            git.Password = "password";
            git.transactionId = "x";
            
            getItem gi = new getItem();
            gi.arg0 = git;
            
            //from support.ptc.com Document-CS206732
            getItemResponse gir = null;
            gir = proxyClient.getItem(gi);

            if (gir != null)
            {
                Item item = gir.@return;
                NullableShortString item0 = (NullableShortString)item.ItemField[0].Item;
                NullableString item1 = (NullableString)item.ItemField[1].Item;
                string item2 = ((string)item.ItemField[2].UserRecord[0].user.Item);
                NullableShortString item3 = (NullableShortString)item.ItemField[3].Item; 
                NullableShortString item4 = (NullableShortString)item.ItemField[4].Item;
                string item5 = (string)item.ItemField[5].Item;
            
                //cast output as strings
                string Type = item5;
                string Title = (string)item0.Item;
                string Priority = (string)item4.Item;
                string Department = (string)item3.Item;
                string user = item2;
                string body = (string)item1.Item;&lt;/PRE&gt;</description>
    <pubDate>Mon, 20 Nov 2017 18:10:27 GMT</pubDate>
    <dc:creator>halem</dc:creator>
    <dc:date>2017-11-20T18:10:27Z</dc:date>
    <item>
      <title>C# SOAP Client</title>
      <link>https://www.ptcusercommunity.com/t5/Systems-Software-Engineering/C-SOAP-Client/m-p/491547#M5634</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am using Visual Studio and C# to create a SOAP client for Integrity 10.2&amp;nbsp; web services.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on some questions here, I was able to make this working code: (actually fails due to a bug with jboss, but completes the request)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;            AttachmentRequest arg0 = new AttachmentRequest();
            arg0.AttachmentName = "distributionowners.txt";
            arg0.FieldName = "Attachments";
            arg0.ItemId = "1234";
            arg0.Username = "username";
            arg0.Password = "password";
            fetchAttachments fa = new fetchAttachments();
            fa.arg0 = arg0;
            fetchAttachmentsResponse response = proxyClient.fetchAttachments(fa);&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I just want to do getItem and createItem requests, but the format for getItem in the API seems different. The closest I was able to get was this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;            Console.WriteLine(proxyClient.Endpoint.Address.Uri);
            getItemRequest req = new getItemRequest();
            req.getItem.arg0.Username = "username";                  //null reference
            req.getItem.arg0.Password = "password";
            req.getItem.arg0.InputField = inputfields;
            req.getItem.arg0.ItemId = "1234";
            getItem gi = new getItem();
            gi.arg0 = req.getItem.arg0;
            getItemResponse responsegi = proxyClient.getItem(gi);&lt;/PRE&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;I'm not able to set the arg0 properties and it fails. How should I be doing this?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 13:30:37 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Systems-Software-Engineering/C-SOAP-Client/m-p/491547#M5634</guid>
      <dc:creator>halem</dc:creator>
      <dc:date>2017-11-15T13:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: C# SOAP Client</title>
      <link>https://www.ptcusercommunity.com/t5/Systems-Software-Engineering/C-SOAP-Client/m-p/492090#M5651</link>
      <description>&lt;P&gt;I got it to work using the following code:&lt;/P&gt;
&lt;PRE&gt;using integrity;&lt;BR /&gt;&lt;BR /&gt;//onclick event for vsta form button&lt;BR /&gt;public void CTRL12_5_Clicked(object sender, ClickedEventArgs e)
        {
            # region createhttpbinding
            BasicHttpBinding basicHttpbinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
            basicHttpbinding.Name = "BasicHttpBinding_Integrity";
            basicHttpbinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
            basicHttpbinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            EndpointAddress endpointAddress = new EndpointAddress("http://servername:7001/webservices/10/2/Integrity/");
            Integrity_10_2Client proxyClient = new Integrity_10_2Client(basicHttpbinding, endpointAddress);
            #endregion

            //set fields to pull
            string[] inputfields = { 
                        "Title", 
                        "Body",
                        "User", 
                        "Department", 
                        "Priority",
                        "Type"
                                   };

            GetItemType git = new GetItemType();
            git.InputField = inputfields;
            git.ItemId = itemid;
            git.Username = "username";
            git.Password = "password";
            git.transactionId = "x";
            
            getItem gi = new getItem();
            gi.arg0 = git;
            
            //from support.ptc.com Document-CS206732
            getItemResponse gir = null;
            gir = proxyClient.getItem(gi);

            if (gir != null)
            {
                Item item = gir.@return;
                NullableShortString item0 = (NullableShortString)item.ItemField[0].Item;
                NullableString item1 = (NullableString)item.ItemField[1].Item;
                string item2 = ((string)item.ItemField[2].UserRecord[0].user.Item);
                NullableShortString item3 = (NullableShortString)item.ItemField[3].Item; 
                NullableShortString item4 = (NullableShortString)item.ItemField[4].Item;
                string item5 = (string)item.ItemField[5].Item;
            
                //cast output as strings
                string Type = item5;
                string Title = (string)item0.Item;
                string Priority = (string)item4.Item;
                string Department = (string)item3.Item;
                string user = item2;
                string body = (string)item1.Item;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Nov 2017 18:10:27 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Systems-Software-Engineering/C-SOAP-Client/m-p/492090#M5651</guid>
      <dc:creator>halem</dc:creator>
      <dc:date>2017-11-20T18:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: C# SOAP Client</title>
      <link>https://www.ptcusercommunity.com/t5/Systems-Software-Engineering/C-SOAP-Client/m-p/628027#M7024</link>
      <description>&lt;P&gt;can you suggest me how you got the integrity class for C#. did you created your self or you used some other library?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 05:04:56 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Systems-Software-Engineering/C-SOAP-Client/m-p/628027#M7024</guid>
      <dc:creator>varatharasan</dc:creator>
      <dc:date>2019-09-24T05:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: C# SOAP Client</title>
      <link>https://www.ptcusercommunity.com/t5/Systems-Software-Engineering/C-SOAP-Client/m-p/628092#M7025</link>
      <description>&lt;P&gt;It's generated by visual studio using the webservice definitions in integrity&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. In Visual Studio, go to Solution Explorer on the right side &amp;gt; expand and right-click References &amp;gt; add Service Reference (requires a project in .net 3.5 or later)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Fill in the address with http://servername:port/webservices/10/2/Integrity/?WSDL and click Go (where 10/2 are your Integrity version numbers)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Set the Namespace to "Integrity" (this is the class name)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Then make sure you include the library:&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Consolas; font-size: 9.5pt;" lang="af"&gt;&lt;SPAN style="color: blue; background: white;"&gt;using&lt;/SPAN&gt;&lt;SPAN style="color: black; background: white;"&gt; [myProject].Integrity;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Consolas; font-size: 9.5pt;" lang="af"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Consolas; font-size: 9.5pt;" lang="af"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 12:47:58 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Systems-Software-Engineering/C-SOAP-Client/m-p/628092#M7025</guid>
      <dc:creator>halem</dc:creator>
      <dc:date>2019-09-24T12:47:58Z</dc:date>
    </item>
  </channel>
</rss>

