Here is the complete error message:
Message security verification failed.
Cannot read KeyIdentifierClause from element 'KeyIdentifier' with namespace
'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'.
Custom KeyIdentifierClauses require custom SecurityTokenSerializers, please refer to the SDK for examples
Here is the story: We are trying to implement a WCF client which talks to a non-WCF web service and most likely the web service has been implemented on J2EE platform. The message sent out from WCF client has to be signed. Fortunately, we were able to find a post at stackoverflow and were able to follow the guidelines / tips in that post. Below is the custom binding:
<customBinding>
<binding name="AccountServiceSoap11Binding1" sendTimeout="00:05:00">
<textMessageEncoding messageVersion="Soap11" />
<security authenticationMode="MutualCertificate" enableUnsecuredResponse="true" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
</security>
<httpsTransport />
</binding>
</customBinding>
We were able to send the request and server responds nicely (we could see the response using fiddler2). Everything works except for the above exception occurred. We did search and found out couple suggestions or clues listed below:
One: sceanairo#12: Incorrect version of security header
blogs.msdn.com/b/distributedservices/archive/2011/03/07/wcf-security-interop-scenarios.aspx
Two: ask vendor to make some changes
social.msdn.microsoft.com/Forums/vstudio/en-US/0732bb4d-7dbb-4b43-8821-3f0caba600eb/cannot-read-keyidentifierclause-from-element-x509issuerserial-with-namespace?forum=wcf
Please advise what we could do to avoid the exception.
Many thanks,
Peter
Related
I need your help to find the best way to call a soap web-service in c# ?
I know using the web-service reference feature in c# is a good one.
I tried using it and it did not work ?
Here is the xml that I want to post
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://temenos.com/CUSTDETS">
<soapenv:Header/>
<soapenv:Body>
<cus:EDBCUSTDETS>
<WebRequestCommon>
<!--Optional:-->
<company></company>
<password></password>
<userName></userName>
</WebRequestCommon>
<EDBCUSTDETSType>
<!--Zero or more repetitions:-->
<enquiryInputCollection>
<columnName></columnName>
<criteriaValue></criteriaValue>
<operand>EQ</operand>
</enquiryInputCollection>
</EDBCUSTDETSType>
</cus:EDBCUSTDETS>
</soapenv:Body>
</soapenv:Envelope>
After adding the reference for the WSDL in the service references folder, I named it as ServiceReference1.
Now I Can see in my code :
How to achieve this request ?
how can I add company, password and user Name and the enquiryInputCollection parameters ?
Is there any best practice for achieving this ?
Thanks.
If you have successfully generated proxy classed from WSDL, then you should be good to go. I assume you should have been provided web service documentation for consuming them.
Look for service client classes to begin with.
eg:
var client = new ServiceReference1Client();
client. ? //(should list Methods and you can find Types of Paramaters to build them.)
If you check in web.config/app.config, and if you see and <client> and <endpoint />, this is where you supply endpoint address. If you need to send client certificate you might want to start with either or and setting security eg:
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
There are lot of resources on WCF capabilities to achieve this. Hope this helps mate.
There is similar question is available here
GZIP compress the request to a remote web service via WCF
When I have implemented solution provided by expert
i.e. WCF client endpoint compression
here is my web.config file code
<bindings>
<customBinding>
<binding name="NAME" >
<binaryMessageEncoding compressionFormat="GZip"/>
<httpsTransport/>
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="MYENDPOINTURL"
binding="customBinding" bindingConfiguration="NAME"
contract="ICONTRACT" name="BulkRequestTransmitterPort" />
</client>
below is error I am getting
Error: The content type text/xml;charset=utf-8 of the response message does not match the content type of the binding (application/soap+msbin1+gzip). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 807 bytes of the response were: '
soapenv:Client
The request message must be sent using HTTP compression (RFC 1952 - GZIP).
TPE1112
'
Can someone please tell me where I am doing wrong?``
Thanks
I've created a WCF Service to upload images. It works fine with images < 50KB or so but I get "The remote server returned an error: (400) Bad Request." with larger images.
I've been looking for ages and tried lots of different things, including setting the maxRequestLength and several other settings.
On the client-side of things the web.config is picking it up as a basicHttpBinding and I'm after a wsHttpBinding (for the more up-to-date feature-set). If I manually change the the binding type to wsHttpBinding and change the corresponding options, I get a Unsupported Media Type error.
Lookingin the WCF Test Client it shows the service as a basicHttpBinding too.
So my question is two-fold really.
What do I need to do to allow my service to handle files > 50KB?
What do I need to change for my service to be recognised as wsHttp instead of basicHttp?
Apologies if there is a question answering these - I have scoured stackoverflow and tried a few suggestions but it is possible I've missed it!
EDIT: As is always the way, I've managed to solve the wsHttpBinding issue now by fiddling around with the service web.config and manually changing the endpoint to wsHttpBinding. Still getting the large upload filesize issue though.
you will need to update your bindings in you web.config
e.g. this is how i did in my wcf restful service. i believe it will be very similar in your case as well
<bindings>
<webHttpBinding>
<!-- buffer: 64KB; max size: 64MB -->
<binding name="StreamedBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" transferMode="Streamed"
maxBufferPoolSize="67108864" maxBufferSize="65536" maxReceivedMessageSize="67108864">
</binding>
</webHttpBinding>
</bindings>
<service name="WCFRestFul.ApiRestful">
<endpoint address="" binding="webHttpBinding"
bindingConfiguration="StreamedBinding" bindingName="StreamedBinding"
contract="WCFRestFul.IApiRestful" behaviorConfiguration="web" />
</service>
I have a WCF Webservice hosted on IIS which exposes a single method that takes three integer parameters. I have a simple, console based client which can call this method.
int InsertNewOrder(short quantity, int custID, int productID);
If my understanding is correct, I need to provide JMeter a SOAP envelope with the details of the method to be called and parameters to be passed. I have seen many examples similar to below:
<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/">;
<soapenv:Body>
<ns2:InsertNewOrder xmlns:ns2="?????">
<ns2:Param1>${1}</ns2:Param1>
<ns2:Param1>${1}</ns2:Param1>
<ns2:Param1>${1}</ns2:Param1>
</ns2:InsertNewOrder>
</soapenv:Body>
</soapenv:Envelope>
However, from looking at my WSDL doc, I don't see where it refers to any of the parameters needed to pass to the method. I've also used Fiddler to examine the client's soap messages to the service. Again, I don't see where it's passing the parameters. As a result, I don't know how to create a simple SOAP envelope I can use with JMeter to test this service.
Can anyone advise as to why the WSDL doc does not provide any details of the method parameters, or explain how I can create the necessary SOAP envelope for use with JMeter?
I am coding in C# using VS 2010, JMeter 2.4, IIS v6, wsHttpBinding.
Disclaimer: I'm not a WSDL expert, so i can't tell you why the doc doesn't provide detail.
To generate the SOAP envelope for JMeter, I've used the free version of soapUI.
Steps
Import WSDL into soap
Create a default request for the method
Set the request view to RAW, and copy into JMeter
This provides me all the information I need for jmeter, including parameters, user-agent, endpoint, etc.
Use JMeter's "HTTP Proxy Server" to record the WCF calls with your normal testclient, and then play them back later when testing. This is what I have experienced to be fastest, and gives the best test-cases (because you record them with your normal client, or test client of choice).
Set up JMeters HTTP Proxy Server as per instructions. Then, make sure the WCF (or any SOAP) client use that proxy. The important part of the WCF client configuation is (replace my ... with normal config):
<system.serviceModel>
<bindings>
...
<wsHttpBinding>
<binding ... proxyAddress="http://proxyServerName:8080" useDefaultWebProxy="false" ...>
...
<security mode="None">
<message establishSecurityContext="false"/>
<transport clientCredentialType="None"/>
</security>
proxyServerName is localhost, if the WCF client runs on the same machine as JMeter (normal when creating the test cases).
Also, I got an error message using HTTP Proxy, if I did not turn off security as shown above. The same security settings must also be at the WCF service server.
Happy testing! :-)
I'm trying to create a web service using Azure.
For the time being, everything is being run locally. The web service and Azure work fine, a simple string Test() method which returns "Hello world" works without problems, as you'd expect. ;)
Now, I've created two methods which add rows to Azure Data Tables. The first sends (using a special DataContract) a single row of data, and this works fine.
The second is for sending larger amount of data, and sends an IEnumerable. So, to test the service, I've created a client application which creates a number of random data to send. If I create up to 42 rows and send that, all goes well.
Above that, I get a 400 Bad request error.
The problem is that there's no inner message to work with (or rather, that WAS the inner message). I strongly suspect it has to do with the size of the request however.
Note, that if I put a breakpoint on the service's method, it doesn't even get that far. I've read quite a few various forum posts regarding similar issues, but those seemed to deal with ordinary WCF services, not Azure ones, and so the Web.config file doesn't contain definitions for bindings nor endpoints, which would be something I could work with.
Please help.
PS. I realise I may have posted very little information. If something else is needed, please ask, and I'll do my best to include it.
Adding the following lines to the Web.config file (under system.serviceModel) in the Azure service project (NOT the Web.config in the client application) resolved the issue:
<bindings>
<basicHttpBinding>
<!--The basicHttpBinding is used for clients which use the generated code to transmit data; the following
settings make it possible to send larger amounts to the service-->
<binding maxReceivedMessageSize="10000000" receiveTimeout="01:00:00">
<readerQuotas maxStringContentLength="10000000" />
</binding>
</basicHttpBinding>
</bindings>