on 11-30-2012 4:53 PM
Is it possible to get the faultcode and faultstring of a soap webservice through a wcf client? (PB.Net 12.5)
I'm getting right now a different error message using the System.Reflection.TargetInvocationException, I did a little of research (Google) and found that I should try with FaultException, but my catch falls into System.Reflection.TargetInvocationException, and I'm not getting the right error description.
Any help?
I received this suggestion for a .Net developer
Is it possible to override .Net classes been used by PowerBuilder itself?, I mean: even if I inherit that System.ServiceModel.Channels.Message class, I'm not directly invoking it, can I make PB to use my class and not the one from .Net Framework?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it possible to override .Net classes been used by PowerBuilder itself?
No, not really. That's one of the benefits of WCF that PowerBuilder shielded us from with their implementation. They have enumerated types for all of the classes that .Net provides, but no mechanism to create our own .Net class and use it instead of a .Net provided class. WCF, at heart, does have that capability.
However, the last I saw on this, the error message about encoding was being returned by the service PB was calling, not by the PB WCF client. Changing the class that the PB WCF client uses wouldn't made any difference if that is the case.
Hi Bruce
No, the webservice that I'm using returns no error, I can see the response message thru TraceTCP, and its fine.
When that response is being catch on PowerBuilder throws and TextDecoder exception, because of a "ó" character that can not be translated: "Unable to translate byte [F3] at index 0 ... etc etc."
It is supposed to be on utf-8, and if I check that character on the array of the exception variable is a 243 value.
This is the 3rd party response, and as far as I understand is utf-8:
HTTP/1.1 100 Continue
HTTP/1.1 500 Internal Server Error
Server: gSOAP/2.7
Content-Type: text/xml; charset=utf-8
Content-Length: 576
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sgdata="urn:sgdata"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>0</faultcode><faultstring>Exception</faultstring><detail>Error en multiSignedMessage_Init. Err=[SeguriSign] - Transacción de Autenticación - La información no es auténtica</detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did this resolve your question?
If so, can you mark the question answered and indicate which responses you found helpful and/or correct.
If not, could you let us know what you still have questions about?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The last I saw on this, you reported that PowerBuilder was returning:
"Unable to translate byte [F3] at index 0 from specified code page to Unicode."
The trace logs you provided from Fiddler also shows that the service was returning that same text as the message for the InnerException:
<InnerException i:nil="true"/><Message>Unable to translate bytes [F3] at index 0 from specified code page to Unicode.</Message>
That was followed by a stack trace.
It appears that PB is returning the appropriate information. What more were you looking for it to provide? It can only report back what the service gives it.
Hi Bruce
Mmmmm noup, that "<InnerException i:nil="true"/><Message>Unable to translate bytes [F3] at index 0 from specified code page to Unicode.</Message>" is from PowerBuilder.
I posted on Dec 11, 2012 5:49 PM, Dec 19, 2012 10:57 PM and Dec 21, 2012 5:51 PM the error message I should be receiving (using Fiddler and TCP Trace apps).
Also, here's another example (calling another method of the same webservice)
this is what I'm getting in PB:
and this is what I should be getting:
remember: this is a 3rd party webservice that I'm consuming on my own webservice developed in PB 12.5.1 .Net, and I'm using a WCF client to consume it, no SOAPException works for it when it fails (the 3rd party one).
I've created a WCF service that has a of_badmethod that has:
Exception myerror
myerror = create Exception
myerror.SetMessage("this is a test")
throw myerror
return "Hello World"
You need to set the IncludeExceptionDetailsInFaults attribute on the service when you deploy it to ensure that you get the details down to the client.
I then created a WCF client that calls that method and traps for System.Exception. If an exception occurs, I check the InnerException property.
exceptiontest.exceptiontest_n_customnonvisualClient proxy
proxy = create exceptiontest.exceptiontest_n_customnonvisualClient
string ls_result
try
ls_result = proxy.of_badmethod()
catch ( System.Exception e )
ls_result = e.InnerException.Message
end try
MessageBox ( "result", ls_result )
It's all working as expected. We're either going to need access to the same method you're calling or a reproducible sample case before we can determine why it's not working for you.
Hi Bruce thanks for your time
Mmmm, wcf client of a wcf service works fine, but this is a SOAP webservice (the one that I'm calling) using a wcf client.
Should it be the same?
this is the XML that my SOAP webservice is returning me:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sgdata="urn:sgdata"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>0</faultcode><faultstring>Exception</faultstring><detail>Error en multiSignedMessage_Init. Err=[SeguriSign] - Transacción de Autenticación - El documento se ha cerrado</detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
about giving you access to my SOAP webservice I need authorization just wait to tomorrow..... please !!.
OK, here's what I ended up adding to your exception handler to get the detail of the message:
catch (System.Reflection.TargetInvocationException e1)
System.ServiceModel.FaultException e2
e2 = e1.InnerException
System.ServiceModel.Channels.MessageFault fault
fault = e2.CreateMessageFault()
ls_message = "Clase: uo_bcfeWS, Método: registraUnilateral ~r~n" + "Exception(1): " + fault.Reason.ToString()
if (fault.HasDetail) then
System.Xml.XmlReader reader
reader = fault.GetReaderAtDetailContents()
ls_message += " " + reader.Value
do while reader.Read()
ls_message += reader.Value
loop
end if
MessageBox ( "Error", ls_message )
Here's the error that is appearing in the Fiddler capture:
And here is the error that PowerBuilder ends up displaying:
Hi Bruce!
I implemented that script but I'm getting a:
Unable to cast object of type 'System.Text.DecoderFallbackException' to type 'System.ServiceModel.FaultException' on my client.
it works fine for the error displayed for singing with a expired certificate:
But authenticating a message which multilateral signature is closed, returns this:
This one returns the Unabled to translate bytes [F3] at index 0 from specified code page to Unicode ..., you can reproduce this by sending '97' on as_idProceso argument to registraMultilateral method (be sure to send all the arguments, 'cause if you don't you'll get another error message).
Values:
as_folio = 'I-005-000001'
abt_doctoOrig[] = byte array with the content of file sistemaMulti.doc
as_nombreDocOrig = 'sistemaMulti.doc'
abt_docFirm[] = byte array with the content of file sistemaMulti.fir
as_nombreDocFirm = 'sistemaMulti.fir'
as_idProceso = '97'
as_secuencia = null
ab_ultimafirma = true
Message was edited by: Claudia Perez
You might try this then:
catch (System.Reflection.TargetInvocationException e1)
String excType
excType = e1.InnerException.GetType().ToString()
choose case excType
case "System.ServiceModel.FaultException"
System.ServiceModel.FaultException e2
e2 = e1.InnerException
System.ServiceModel.Channels.MessageFault fault
fault = e2.CreateMessageFault()
ls_message = "Clase: uo_bcfeWS, Método: registraUnilateral ~r~n" + "Exception(1): " + fault.Reason.ToString()
if (fault.HasDetail) then
System.Xml.XmlReader reader
reader = fault.GetReaderAtDetailContents()
ls_message += " " + reader.Value
do while reader.Read()
ls_message += reader.Value
loop
end if
case "System.Text.DecoderFallbackException"
System.Text.DecoderFallbackException e3
e3 = e1.InnerException
ls_message = "Clase: uo_bcfeWS, Método: registraUnilateral ~r~n" + "Exception(1): " + e3.Message
case else
ls_message = "Clase: uo_bcfeWS, Método: registraUnilateral ~r~n" + "Exception(1): " + e1.Message
end choose
MessageBox ( "Error", ls_message )
//logError(ls_message)
return false
But what that's going to get us back to, at least in this case, is "Unable to translate bytes [F3] at index 0 from specified code page to Unicode."
Yes, I know...
The argument of this 3rd party is that they're not having this problem with other customers, only with us.. and the returned message from their webservice seems to be right:
HTTP/1.1 100 Continue
HTTP/1.1 500 Internal Server Error
Server: gSOAP/2.7
Content-Type: text/xml; charset=utf-8
Content-Length: 572
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sgdata="urn:sgdata"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>0</faultcode><faultstring>Exception</faultstring><detail>Error en multiSignedMessage_Init. Err=[SeguriSign] - Transacción de Autenticación - El documento se ha cerrado</detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
And I believe it to 'cause I can see it thru Fiddler or Tcp Trace... so....
I'm not sure what you're trying to say with that last one, it's still the certificate expired message.
One of the biggest mistakes that a lot of web services developers make is they test their web service with the same tool that they used to write it. Java web services developers test their web services using Java. .Net developers test their web services using .Net. PHP developer test their web services using PHP. On and on. Web services are supposed to be implementation agnostic, and the service provider really hasn't demonstrated that they've accomplished that when they use the same tool to test it that they used to write it.
Then when you as a customer do hit it, and use a tool other than the one used to write it, you start reporting all kinds of errors they didn't experience because they didn't use any other client types to hit it.
When you were getting the "Unable to translate bytes [F3] at index 0 from specified code page to Unicode" message, it was coming from the service. You're just not getting it in that response.
"Unable to translate bytes [F3] at index 0 from specified code page to Unicode" is not coming from the 3rd party webservice, PowerBuilder can't convert the XML it receives:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sgdata="urn:sgdata"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>0</faultcode><faultstring>Exception</faultstring><detail>Error en multiSignedMessage_Init. Err=[SeguriSign] - Transacción de Autenticación - El documento se ha cerrado</detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
and causes the "Unable to translate bytes [F3] at index 0 from specified code page to Unicode"
The correct message, which by the way means that the multipart signature No. 97 has been closed and I'm trying to add another signature (authentication) to it, can only be triggered using the registraMultilateral method with the arguments I mentioned on my last post.
If we both agree at this point, is this a PB issue or my 3rd party issue?, 'cause I can't see anything wrong on that XML.
>>If we both agree at this point, is this a PB issue or my 3rd party issue?,
>>'cause I can't see anything wrong on that XML
With that particular one, no. But you've send a couple of trace files in the past that show "Unable to translate bytes [F3] at index 0 from specified code page to Unicode." as being returned from the service.
That's why I wanted a reproducible sample, so I could see exactly what is happening. The sample I have not doesn' t throw that particular error.
Due date is coming and can't solve this, any clue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bruce
Can you be a little more specific? do you mean the XML string that I'm getting with TCP Trace?
This is the request:
POST /SSignTools?wsdl HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Accept-Encoding: gzip, deflate,gzip, deflate
Authorization: Basic d3NkZXNhcjp3c2dlYmNkZXM=
Host: localhost:8081
Content-Length: 3254
Expect: 100-continue
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ProcessMessage xmlns="urn:sgdata"><request xsi:type="q1:MultilateralUpdateRequest" xmlns="" xmlns:q1="urn:sgdata"><idFromInit>97</idFromInit><documentSignedWithoutContent><filename>sistemaMulti.fir</filename><compressed>true</compressed><data>TUlJR0NBWUpLb1pJaHZjTkFRY0NvSUlGK1RDQ0JmVUNBUUV4Q3pBSkJnVXJEZ01DR2dVQU1Bc0dDU3FHU0liM0RRRUhBYUNDQkNRd2dnUWdNSUlEQ0tBREFnRUNBZ0lCY1RBTkJna3Foa2lHOXcwQkFRVUZBRENCL1RFUk1BOEdBMVVFQnhNSVRXVjRhV05oYkdreEdEQVdCZ05WQkFnVEQwSmhhbUVnUTJGc2FXWnZjbTVwWVRFTE1Ba0dBMVVFQmhNQ1RWZ3hEakFNQmdOVkJCRVRCVEl4TURBd01SWXdGQVlEVlFRSkV3MURaVzUwY204Z1EybDJhV052TVVFd1B3WURWUVFERXpoQlF5QkVaWE5oY25KdmJHeHZJR1JsYkNCSGIySnBaWEp1YnlCa1pXd2dSWE4wWVdSdklHUmxJRUpoYW1FZ1EyRnNhV1p2Y201cFlURWxNQ01HQTFVRUN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YkFQZitNclJSS3JwRXBubWRQR1RvR3hHRWRDSi9wU0Y0LzU5SGJWb2d2Q00xUWZjSEpZTk14b1pVQ25Xb281WktiQ2xLQ2h6Y2V5ZHl4NHRvVGYycE8wVUtXQ0hwRk1GWWRBM0ZhdFEvZ1BZbHhGWWVDOXhKWGpueXFFU0ht</data></documentSignedWithoutContent></request></ProcessMessage></s:Body></s:Envelope>
This is the response:
HTTP/1.1 100 Continue
HTTP/1.1 500 Internal Server Error
Server: gSOAP/2.7
Content-Type: text/xml; charset=utf-8
Content-Length: 572
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sgdata="urn:sgdata"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>0</faultcode><faultstring>Exception</faultstring><detail>Error en multiSignedMessage_Init. Err=[SeguriSign] - Transacción de Autenticación - El documento se ha cerrado</detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
That trace shows that the "Unable to translate byte [F3] at index 0 from specified code page to Unicode" error is being returned from the server (something I should have realized earlier since it showed up in TcpTrace) and it also provides a stack fault from the server for where the error occurred at.
You're getting the error message correctly by reading the inner exception. You need to share this with the folks running the web service so they can determine where the error is occurring at in their code. It still points to an encoding issue, but it's most likely the server having a problem with the data you're sending in the request.
The captures from TCPTrace that you attached show that text in the exception and a stack trace:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode><faultstring xml:lang="en-US">Exception has been thrown by the target of an invocation.</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>Unable to translate bytes [F3] at index 0 from specified code page to Unicode.</Message><StackTrace>
Server stack trace: 
at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)
at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index)
at System.Text.DecoderFallbackBuffer.InternalFallback(Byte[] bytes, Byte* pBytes, Char*& chars)
at System.Text.UTF8Encoding.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, DecoderNLS baseDecoder)
at System.Text.UTF8Encoding.GetChars(Byte[] bytes, Int32 byteIndex, Int32 byteCount, Char[] chars, Int32 charIndex)
at System.Xml.ValueHandle.TryReadChars(Char[] chars, Int32 offset, Int32 count, Int32& actual)
at System.Xml.XmlBaseReader.ReadValueChunk(Char[] chars, Int32 offset, Int32 count)
at System.Xml.XmlBinaryWriter.WriteTextNode(XmlDictionaryReader reader, Boolean attribute)
at System.Xml.XmlDictionaryWriter.WriteNode(XmlDictionaryReader reader, Boolean defattr)
at System.ServiceModel.Channels.ReceivedFault.CreateFault11(XmlDictionaryReader reader, Int32 maxBufferSize)
at System.ServiceModel.Channels.MessageFault.CreateFault(Message message, Int32 maxBufferSize)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
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 signature.SgSignToolsWSPortType.ProcessMessage(ProcessMessageRequest request)
at signature.SgSignToolsWSPortTypeClient.signature.SgSignToolsWSPortType.ProcessMessage(ProcessMessageRequest request)
at signature.SgSignToolsWSPortTypeClient.ProcessMessage(request request)</StackTrace><Type>System.Text.DecoderFallbackException</Type></InnerException><Message>Exception has been thrown by the target of an invocation.</Message><StackTrace> at addinassembly.c__signature_sgsigntoolswsporttypeclient.processmessage(request request) in c:\Users\cperez\Documents\GT\Padron de Certificados e Interfaz\LibNet\bcfeWS\bcfews.out\{addinassembly}signature_sgsigntoolswsporttypeclient.processmessage(Csignature+response.Csignature+request.):line 48
at bcfews.c__uo_bcfews.registramultilateral_11_493506876(PBString as_folio, PBArray abt_doctoorig, PBString as_nombredocorig, PBBoolean ab_comprimidoorig, PBArray abt_doctofirm, PBString as_nombredocfirm, PBBoolean ab_comprimidofirm, PBString& as_idproceso, PBString& as_secuencia, PBBoolean ab_ultimafirma, PBBoolean ab_concontenido) in c:\Users\cperez\Documents\GT\Padron de Certificados e Interfaz\LibNet\bcfeWS\bcfews.out\{bcfews}uo_bcfews.registramultilateral(BSE[]SBE[]SBRSRSBB):line 64
at bcfews.c__uo_bcfews.registramultilateral_11_4935061184074792(c__uo_bcfews this__object, PBString as_folio, PBArray abt_doctoorig, PBString as_nombredocorig, PBBoolean ab_comprimidoorig, PBArray abt_doctofirm, PBString as_nombredocfirm, PBBoolean ab_comprimidofirm, PBString& as_idproceso, PBString& as_secuencia, PBBoolean ab_ultimafirma, PBBoolean ab_concontenido) in c:\Users\cperez\Documents\GT\Padron de Certificados e Interfaz\LibNet\bcfeWS\bcfews.out\bcfews_uo_bcfews_u.cs:line 0
at bcfews.c__uo_bcfews.autenticar_3_493506876(c__str_bcfeautenticardocrequest astr_datos, PBArray abt_doctoorig, PBArray abt_doctofirmado) in c:\Users\cperez\Documents\GT\Padron de Certificados e Interfaz\LibNet\bcfeWS\bcfews.out\{bcfews}uo_bcfews.autenticar(Cbcfewsassembly+str_bcfeautenticaciondoc.Cbcfewsassembly+str_bcfeautenticardocrequest.E[]E[]):line 73
at bcfews.c__uo_bcfews.autenticar_3_493506876_3_uo_bc145156553(c__uo_bcfews this__object, c__str_bcfeautenticardocrequest astr_datos, PBArray abt_doctoorig, PBArray abt_doctofirmado) in c:\Users\cperez\Documents\GT\Padron de Certificados e Interfaz\LibNet\bcfeWS\bcfews.out\bcfews_uo_bcfews_u.cs:line 0
at bcfews.c__uo_bcfews.autenticarevid_4_524696403(c__str_bcfeautenticardocrequest astr_datos, PBArray abt_doctoorig, PBArray abt_doctofirmado, PBArray& astr_firmantes) in c:\Users\cperez\Documents\GT\Padron de Certificados e Interfaz\LibNet\bcfeWS\bcfews.out\{bcfews}uo_bcfews.autenticarevid(Cbcfewsassembly+str_bcfeautenticaciondoc.Cbcfewsassembly+str_bcfeautenticardocrequest.E[]E[]RCbcfewsassembly+str_bcfefirmante.[]):line 9
at bcfeWS.uo_bcfews.autenticarEvid(str_bcfeautenticardocrequest astr_datos, Byte[] abt_doctoorig, Byte[] abt_doctofirmado, str_bcfefirmante[]& astr_firmantes) in c:\Users\cperez\Documents\GT\Padron de Certificados e Interfaz\LibNet\bcfeWS\bcfews.out\bcfews_uo_bcfews_wrapper.cs:line 172
at SyncInvokeautenticarEvid(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.Reflection.TargetInvocationException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>
What is the value of the InnerException.Message attribute of the TargetInvocationException?
Have you use Fiddler or Charles to determine what exactly the service is returning?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bruce
on the InnerException I'm getting this:
Unable to translate byte [F3] at index 0 from specified code page to Unicode.
I can't give you the InnerException.Message value 'til Monday 'cause I'm out of the office and can reach the server to reproduce the error.
I have never use Fiddler or Charles (don't know how really), I used the TCPTrace to see the Webservice response and has nothing to do with the InnerException error because it returns a customized message about a validation that the process can't commit.
Both Fiddler and Charles are easy to use. Just install them, start them and they start acting as the default proxy for your workstation. Make the webservice call and you can see exactly what is being transmitted and returned. Fiddler is free. Charles costs money, but has some additional features such as support for AMF.
It would help to see exactly what the services is returning when the fault occurs (including the message type it's returning).
Hi Claudia,
I think I'm having the same or similar problem. I can catch the error as a System.Exception
...catch (System.Exception ex)
And even though the ex shows 'System.Reflection.TargetInvocationException', I can see in debug the details of the error - I just can't figure out how to drill down.
Then I tried declaring and assigning the system.exception ex to a FaultException (you must add a reference to System.ServiceModel)
...System.ServiceModel.FaultException myex
...myex = ex.InnerException
...ls_RetString = myex.message
And this works - I can display myex.message, but I still can't drill down to the detail that I need (even though I can see it tantalizingly close in debug)
My research suggests that I need to cast the FaultException to the basefaultclass defined and created by the wsdl, but I can't figure out how to do this. I've tried this:
...System.ServiceModel.FaultException<[my basefaultclass]> myex
but it won't compile.
Hope someone can help us!
Regards,
Mary
Hi Claudia,
If I understand what Bruce is saying you should add the following to your try/catch block in order to get the underlying error...
catch (TargetInvocationException tiEx)
MessageBox('Error', tiEx.GetBaseException().InnerException.Tostring())
You will need to add System.Reflection to the Namespace/Usings area of your window.
hth,
Mark
All I got with catch(System.Reflection.TargetInvocationException tiEx) was the following.
---------------------------
PowerBuilder application execution error.
---------------------------
Application terminated.
Error: Null object reference at line 49 in function uf_findmercprof of object n_cst_user_web_services.
---------------------------
OK
---------------------------
Just an educated guess, but it appears that the exception text being returned contains accented characters. It may be that they are using a text encoding other than what WCF supports and so WCF is having problems converting that text. That is, you're probably getting what you need from the innerexception, except that WCF is having problems with the message itself.
Do you have any control over the service? Can you get them to return text that doesn't return accented characters?
See in particularly this MSDN blog entry, which was originally in Italian. I had to have it translated to English so I could follow it:
However, it appears that the web service is indicating that it's using UTF-8 encoding, at least based on what I see from your image.
Hi Bruce
First of all is a third-party Webservice the one that I'm using, so I can't change anything.
I'm using this on my web.config (client):
.
.
.
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_uo_bcfeWS_ServiceContract" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transferMode="Buffered" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
<binding name="BasicHttpBinding_ssigntools_ServiceContract" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transferMode="Buffered" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
.
.
.
<service name="addinassembly.signature_sgsigntoolswsporttypeclient" behaviorConfiguration="ServiceNameBehavior">
<!-- this endpoint is exposed at the base address provided by host: http://serverName/VirtualDirectoryName/ServiceName.svc -->
<endpoint address="" bindingConfiguration="BasicHttpBinding_ssigntools_ServiceContract" binding="basicHttpBinding" contract="addinassembly.signature_sgsigntoolswsporttypeclient" />
<!-- the mex endpoint is exposed at http://serverName/VirtualDirectoryName/ServiceName.svc/mex -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
I found this on the sybase site:
Use the WCFBasicHttpBinding class for communication between a WCF client and ASMX-based Web services or other services that conform to the WS-I Basic Profile 1.1.
WCFBasicHttpBinding property | Type | Description |
---|---|---|
TransferMode | WSTransferMode (enumeration) | Gets or sets a value to indicate whether messages are buffered or streamed. Values are: BUFFERED(default), STREAMED, STREAMEDREQUEST, and STREAMEDRESPONSE. |
MessageEncoding | WSMessageEncoding (enumeration) | Specifies encoding for SOAP messages. Values are: Text (default), and MTOM (Message Transmission Optimization Mechanism). |
TextEncoding | WSTextEncoding (enumeration) | Specifies character encoding for the SOAP message text. Values are: ASCII, BIGENDIANUNICODE,UNICODE, UTF32, UTF7, and UTF8 (default). |
So if UTF8 is the default, what do I need to convert? :'(
User | Count |
---|---|
81 | |
10 | |
10 | |
8 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.