Auteur de questions
Erreur avec un Web Service Java

Question
-
Bonjour,
J'essaie de m'interfacer avec un service web java en utilisant wcf et lors de l'appel au servic e j'obtiens l'erreur suivante:
System.InvalidOperationException was unhandled
Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Client found response content type of 'multipart/related; boundary=MIMEBoundaryurn_uuid_F45CAB32FE9F81BAE61262953873129; type=\"application/xop+xml\"; start=\"<0.urn:uuid:F45CAB32FE9F81BAE61262953873130@apache.org>\"; start-info=\"text/xml\";charset=windows-1252', but expected 'text/xml'.
The request failed with the error message:
--
--MIMEBoundaryurn_uuid_F45CAB32FE9F81BAE61262953873129
Content-Type: application/xop+xml; charset=utf-8; type=\"text/xml\"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:F45CAB32FE9F81BAE61262953873130@apache.org><?xml version=\"1.0\" encoding=\"utf-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">...</soapenv:Envelope>
--MIMEBoundaryurn_uuid_F45CAB32FE9F81BAE61262953873129--
--."
Source="CSClient"
StackTrace:
at CSClient.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at CSClient.My.MyProject.MyForms.get_Form1()
at CSClient.My.MyApplication.OnCreateMainForm() in C:\...\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at CSClient.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
J'utilise un client de type BasicHTTPBinding existe t'il un moyen de corriger cela sans redevelopper un client complet?
Si non, quelle sont les methodes préconisées?
Merci,
Toutes les réponses
-
Bonjour,
Le problème vient du fait que votre client est configuré pour lire du XML et non du MTOM.
Dans le configuration de votre client mettez :
<basicHttpBinding>
<binding name="basicHttpStreaming" messageEncoding="Mtom" />
<basicHttpBinding>
Cordialement
Gilles TOURREAU - MVP C# - Architecte .NET/Consultant/Formateur -
Bonjour,
Tout d'abord merci pour votre réponse, mais cela ne suffit apparement pas.
Voici ma configuration telle qu'elle est générée par VS:
<basicHttpBinding>
<binding name="ChangeServiceHttpBinding"
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
Et voici ce que j'obtiens en changeant 'Text' par 'Mtom'
The content type multipart/related; boundary=MIMEBoundaryurn_uuid_39EA96330B140F3CDB1264415347457; type="application/xop+xml";
start="<0.urn:uuid:39EA96330B140F3CDB1264415347458@apache.org>"; start-info="text/xml";charset=windows-1252 of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml").
If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
The first 715 bytes of the response were:
'--MIMEBoundaryurn_uuid_39EA96330B140F3CDB1264415347457 Content-Type: application/xop+xml; charset=utf-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: <0.urn:uuid:39EA96330B140F3CDB1264415347458@apache.org>
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>The authentication server is not available. Contact your administrator.</faultstring><detail><ns1:LoginFault xmlns:ns1="http://www.telelogic.com/change/types"></ns1:LoginFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_39EA96330B140F3CDB1264415347457--'.