Connection to Portfolio 2016 using SOAP and C#


I am using C# 2013 and the Portfolio SOAP API to connect to Portfolio 2016 but get the error “The server committed a protocol violation. Section=ResponseStatusLine” when I attempt to get a RSA key with the call keySpecification key = service.getRSAPublicEncryptionKey();

code snippet :-
AssetSEIService service = new AssetSEIService();
service.Url = “http://xxxxxxxxx:8090/ws/1.0/AssetService”;

        // Use getRSAPublicEncryptionKey to get the necessary Key for encrypting the password.
   keySpecification key = service.getRSAPublicEncryptionKey();
catch (Exception ex)

The error occurs for all target framework versions 2.0, 3.5 and 4.5.1. Calls from this program to other non-Portfolio SOAP web services on our estate are working fine.

Also, a call to the portfolio api method getRSAPublicEncryptionKey method works fine through SoapSonar, and returns the following :-

<?xml version="1.0" encoding="UTF-8"?>

<S:Envelope xmlns:S=“http://schemas.xmlsoap.org/soap/envelope/”>
<ns2:getRSAPublicEncryptionKeyResponse xmlns:ns2=“http://portfolio.extensis/service/asset”>



which suggests our portfolio 2016 installation is OK.

What am I missing? Please help.


Hi Gordon,

We have not run into this problem. Since you are able to retrieve the RSA key using SoapSonar, that likely indicates something needs to be changed in your C# client code.

Googling for the error you see returned a lot of hits, so I would start there. For instance this page: webmonkeys.org.uk/2012/09/c- … tatusline/

On that page, the author recommends including the line:

request.KeepAlive = false;


request.ServicePoint.Expect100Continue = false;

and/or this in your app.config:


Now, we have not tested using those, but personally I would try each of those in turn and see if that fixes the problem.

Please let us know the results, if you are still blocked on this we can help debug further.

Best wishes,


Hi Loren
I had looked at this page prior to logging my call with you. I do have useUnsafeHeaderParsing=“true” in the clients app.config; but the advice given for keepalive suggests setting keepalive=false on a web request call, i am using a SOAP call as per your sample code and this property is not exposed on a SOAPHttpClientProtocol object. So i am not clear how i can set the suggested properties in client-side code.But I will keep digging.


I have looked server side, specifically at how to configure JBOSS and Apache to set keepalives = false but cant find out where to set the maxKeepAliveRequests to 1 to disable keep-alives (as described in docs.jboss.org/jbossweb/2.1.x/config/http.html)

I did look to set it in the C:\Program Files (x86)\Extensis\Portfolio Server\applications\tomcat\servers\admin\conf\server.xml file but this does not define a connector for port 8090.

Any ideas how to set keep-alives off on the server side?
Our server is Windows Server 2012 r2 if that helps,



fixed it!
I need to set theExpect100Continue flag to false. This can be done in a SOAP call in C# by editing the autogenerated code
in AssetSEIService.cs (provided with your code samples) and overriding GetWebRequest as shown below:-

public partial class AssetSEIService : System.Web.Services.Protocols.SoapHttpClientProtocol {

protected override WebRequest GetWebRequest(Uri uri)
    WebRequest request = base.GetWebRequest(uri);
    HttpWebRequest request2 = request as HttpWebRequest;
    //request2.KeepAlive = false; // does not work, causes the connection to fail
    request2.ServicePoint.Expect100Continue = false; // THIS WORKS!!!

    return request2;

Rest of auto generated code unchanged.


Excellent! That’s great to hear, and really good to know for future 3rd party integrators who want to use a C# and SOAP stack.



I started getting the same error when we updated from v2.0.2 to v2.5.3. I tried to implement the above solution for our code, but am not having any success. Using “request2.KeepAlive = false;” results in the same error, using “request2.ServicePoint.Expect100Continue = false;” results in the error:

; nested exception is: extensis.esp.exception.InvalidCredentialsException
; nested exception is: extensis.esp.exception.InvalidCredentialsException
; nested exception is: extensis.esp.exception.InvalidCredentialsException

I have very little C# background, so any help would be greatly appreciated. Thank you!

EDIT: In troubleshooting the error, I found that the problem seems to be associated with using an encrypted catalog password variable. When I modify the code to use the unencrypted password, the connection is successful. I’m going to start a new thread since this is an entirely different issue.


OK, thanks Gordon.