I am trying to consume a Web Service and, though apparently all my parameters seem to be okay, I keep getting an erro page as response instead of an array of bytes which is what I am expecting and what the WebService is supposed to return.
My objective is to Seal a file in order to make them only readable for the right people. I am using the IRM Oracle Web Services to acomplish that, but, though all my parameters semm alright, I can't get the reponse properly.
Acording to the Oraclel support, my request is fine, so it must be something on IIS I guess. Any help?
The content type multipart/related;start="";type="application/xop+xml";boundary="uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73";start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom
encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 748 bytes of the response were: '--uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73 Content-Id: Content-Type: application/xop+xml;charset=utf-8;type="text/xml" Content-Transfer-Encoding:
binary '.
Exception Stacktrace:
Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String
action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest
request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.Seal(Byte[] stream,
String mimeType, SealingOptions options) at HTMLToPDFComponenteConverter.ConvertToPDF.Page_Load(Object sender, EventArgs e)
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "application/vnd.sealedmedia.softseal.pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=Relatorio.spdf");
SealingServicesClient sealingServicesClient =
new SealingServicesClient("SealingServices");
sealingServicesClient.ClientCredentials.UserName.UserName =
ConfigurationManager.AppSettings["Irm-user"];
sealingServicesClient.ClientCredentials.UserName.Password =
ConfigurationManager.AppSettings["Irm-password"];
// Create the classification details used in the sealing options
SealingOptions sealingOptions = new SealingOptions();
// This just set several parameters which the WebService validates. (They're all okay)
sealingOptions.classification = GetClassificationSetUp();
String mimeType = "application/pdf";
// Here is where everything goes wrong. I keep getting an error message.
byte[] sealedFile = sealingServicesClient.Seal(file, mimeType, sealingOptions);
if (sealedFile != null && sealedFile.Length > 0) { Response.AddHeader("Content-Length", sealedFile.Length.ToString());
See the above web.config file, you are using basicHttpBinding of which the content type is based on text/xml, but see the type of response message, it is 'application/xop+xml' instead of 'text/xml', so the type between them is mismatch. Try setting the MessageEncoding
property to 'MTOM'.
Mauricio Ave...
Member
1 Points
6 Posts
Error obtaining the response from a Web Service call.
Jun 18, 2012 03:06 PM|LINK
Hello,
I am trying to consume a Web Service and, though apparently all my parameters seem to be okay, I keep getting an erro page as response instead of an array of bytes which is what I am expecting and what the WebService is supposed to return.
My objective is to Seal a file in order to make them only readable for the right people. I am using the IRM Oracle Web Services to acomplish that, but, though all my parameters semm alright, I can't get the reponse properly.
Acording to the Oraclel support, my request is fine, so it must be something on IIS I guess. Any help?
----------------------------------------------------------------------------------------------------------------------------------------------------------
Exception Message:
The content type multipart/related;start="";type="application/xop+xml";boundary="uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73";start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 748 bytes of the response were: '--uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73 Content-Id: Content-Type: application/xop+xml;charset=utf-8;type="text/xml" Content-Transfer-Encoding: binary '.
Exception Stacktrace:
Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.Seal(Byte[] stream, String mimeType, SealingOptions options) at HTMLToPDFComponenteConverter.ConvertToPDF.Page_Load(Object sender, EventArgs e)
Exception Data:
System.Collections.ListDictionaryInternal
Exception Source:
mscorlib
----------------------------------------------------------------------------------------------------------------------------------------------------------
Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.ContentType = "application/vnd.sealedmedia.softseal.pdf"; Response.AddHeader("Content-Disposition", "attachment; filename=Relatorio.spdf"); SealingServicesClient sealingServicesClient = new SealingServicesClient("SealingServices"); sealingServicesClient.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["Irm-user"]; sealingServicesClient.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["Irm-password"]; // Create the classification details used in the sealing options SealingOptions sealingOptions = new SealingOptions();// Here is where everything goes wrong. I keep getting an error message. byte[] sealedFile = sealingServicesClient.Seal(file, mimeType, sealingOptions); if (sealedFile != null && sealedFile.Length > 0){
Response.AddHeader("Content-Length", sealedFile.Length.ToString());
Response.BinaryWrite(sealedFile); Response.Flush(); Response.End();}
----------------------------------------------------------------------------------------------------------------------------------------------------------
Meu WebConfig está desse jeito:
----------------------------------------------------------------------------------------------------------------------------------------------------------
<system.serviceModel> <client> <endpoint address="https://url:porta/irm_sealing/sealing_services" binding="basicHttpBinding" bindingConfiguration="SealingServicesBinding" contract="sealing_services.SealingServices" name="SealingServices" behaviorConfiguration="IrmSealingAbril"> <identity> <dns value="localhost" /> </identity> </endpoint> </client> <behaviors> <endpointBehaviors> <behavior name="IrmSealingAbril"> <clientCredentials> <clientCertificate storeLocation="LocalMachine" storeName="Root" x509FindType="FindByThumbprint" findValue="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"> </clientCertificate> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> <bindings> <basicHttpBinding> <binding name="SealingServicesBinding" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2097152" maxBufferPoolSize="524288" maxReceivedMessageSize="2097152" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="Transport"> <transport clientCredentialType="Basic" realm="weblogic" /> </security> </binding> </basicHttpBinding> </bindings> </system.serviceModel>Where am I going wrong?
C webservice
Unnics
Member
394 Points
93 Posts
Re: Error obtaining the response from a Web Service call.
Jun 18, 2012 03:25 PM|LINK
Hi,
Can you try to use the below
Response.ContentType = "text/xml";
Response.ContentEncoding = Encoding.UTF8;
hope this will help.
C webservice
Mauricio Ave...
Member
1 Points
6 Posts
Re: Error obtaining the response from a Web Service call.
Jun 18, 2012 05:48 PM|LINK
I did and I am getting the same error message. Exactly the same. Should I do something with the spdf extension on the IIS?
I am sorry, but I am new at this and I do not have much skill at setting up IIS.
Kind regards.
Maurício Avellar
C webservice
Peter pi - M...
Star
12871 Points
1786 Posts
Re: Error obtaining the response from a Web Service call.
Jun 20, 2012 02:52 AM|LINK
See the above web.config file, you are using basicHttpBinding of which the content type is based on text/xml, but see the type of response message, it is 'application/xop+xml' instead of 'text/xml', so the type between them is mismatch. Try setting the MessageEncoding property to 'MTOM'.
http://stackoverflow.com/questions/10496186/error-consuming-webservice-content-type-application-xopxml-does-not-match-ex
C webservice
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
Mauricio Ave...
Member
1 Points
6 Posts
Re: Error obtaining the response from a Web Service call.
Jun 20, 2012 05:37 PM|LINK
Thank you so much. You're a lifesaver. It worked beyond perfect. Thank you for your promptly reply. I'm very gratiful for your help.
C webservice