cancel
Showing results for 
Search instead for 
Did you mean: 

faultcode and faultstring of a soap webservice through a wcf client (PB.Net 12.5)

Former Member
0 Kudos

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?

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I received this suggestion for a .Net developer

c# - Configuring the .NET WCF UTF-8 deserializer to modify/discard non-shortest form chars instead o...

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? 

former_member190719
Active Contributor
0 Kudos
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.

Former Member
0 Kudos

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.

former_member190719
Active Contributor
0 Kudos

If PowerBuilder is blowing up on the response, then the response really isn't encoded in UTF-8.  UTF-8 is supported by WCF out of the box.  You only need a custom encoder when the response is sent in some other encoding.

Former Member
0 Kudos

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>

Former Member
0 Kudos

Hi guys!

Still have no answer for this... .  I already installed EBF22375 (latest one), 'cause I found a link that says that a previous EBF (21365) has bug correction (728848) that has to do with encoding, not about wcf, but hopping it could help and... and it didn't.

former_member190719
Active Contributor
0 Kudos

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?

Former Member
0 Kudos

No Bruce, still have this problem, TCP Trace and Fiddler get the right text, but PB doesn't.

Former Member
0 Kudos

Still need some help here.

Former Member
0 Kudos

Hi Claudia;

   I would suggest opening a case with SAP / Sybase using CaseXpress on this one then.

Regards ... Chris

former_member190719
Active Contributor
0 Kudos

Chris,

You haven't been involved on this thread since it started.  Why the referral to create a case now?  How about letting the folks that have been addressing the issue continue to work on it?

former_member190719
Active Contributor
0 Kudos

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.


Former Member
0 Kudos

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 PMDec 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).

former_member190719
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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  !!.

former_member190719
Active Contributor
0 Kudos

It shouldn't matter one bit whether the service was created as a WCF service or any other kind of service.  The exception should come back the same regardless of how it was created (provided the tool that was used is returning it correctly).

Former Member
0 Kudos

Bruce

At which email can I send you the webservice information?

former_member190719
Active Contributor
0 Kudos

bruce dot armstrong at yahoo dot com

Former Member
0 Kudos

Bruce I sent you the information last week, did you get it?

former_member190719
Active Contributor
0 Kudos

Got it:  Yes

Had chance to do anything with it:  No

Did a release deployment last weekend, been kind of tied up.  Probably get to it later this week.

former_member190719
Active Contributor
0 Kudos

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:

Former Member
0 Kudos

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

former_member190719
Active Contributor
0 Kudos

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."

Former Member
0 Kudos

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....

former_member190719
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

"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.

former_member190719
Active Contributor
0 Kudos

>>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.


Former Member
0 Kudos

OK, now I see where's the confusion.

the captures and pruebaFiddler files I posted are the response from mywebservice to myPBclient, not from my3rdpartywebservice to mywebservice.

the code I sent you has the same design.

Would a video be helpful?

Former Member
0 Kudos

I just sent 2 links to your gmail and yahoo emails to 2 videos showing the trace.

former_member190719
Active Contributor
0 Kudos

Ok, that make sense now.  I was wondering why there was a PB stack trace in the capture.

The capture we need to get is the one between your webservice and theirs.  If they aren't returning the response encoded in UTF-8, that would explain why WCF isn't able to handle the extended characters.

Former Member
0 Kudos

Due date is coming and can't solve this, any clue?

former_member190719
Active Contributor
0 Kudos

Can you attach the actual trace (not a screenshot)?

Since the error code indicates it's having problems converting [F3], which is the unicode character for the accented O, I'm still convinced this is a problem with the encoding of the response message.

Former Member
0 Kudos

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>TUlJR0NBWUpLb1pJaHZjTkFRY0NvSUlGK1RDQ0JmVUNBUUV4Q3pBSkJnVXJEZ01DR2dVQU1Bc0dDU3FHU0liM0RRRUhBYUNDQkNRd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kZ5Y205c2JHOGdaR1ZzSUVkdlltbGxjbTV2SUdSbGJDQkZjM1JoWkc4Z1pHVWdRbUZxWVNCRFlXeHBabTl5Ym1saE1TVXdJd1lEVlFRTERCeEpibTV2ZG1GamFjT3piaUI1SUUxdlpHVnlibWw2WVdOcHc3TnVNUzh3TFFZRFZRUUtFeVpIVDBKSlJWSk9UeUJFUlV3Z1JWTlVRVVJQSUVSRklFSkJTa0VnUTBGTVNVWlBVazVKUVFJQ0FYRXdDUVlGS3c0REFob0ZBREFOQmdrcWhraUc5dzBCQVFFRkFBU0JnRFYwWGk1UHpzYml2ZTdDTFdVY2pCSWt5WFJkTXlhbTVrV1JGVE1kVk1wMUVWYkFQZitNclJSS3JwRXBubWRQR1RvR3hHRWRDSi9wU0Y0LzU5SGJWb2d2Q00xUWZjSEpZTk14b1pVQ25Xb281WktiQ2xLQ2h6Y2V5ZHl4NHRvVGYycE8wVUtXQ0hwRk1GWWRBM0ZhdFEvZ1BZbHhGWWVDOXhKWGpueXFFU0ht</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>

former_member190719
Active Contributor
0 Kudos

That's what I'm looking for.  However Fiddler and Charles have options to save out a session in raw format.  That's what I'm looking for.  I don't know if TcpTrace has that capability or not.

Former Member
0 Kudos

Hi Bruce

I tried to get you what you need, I hope I have done well. 

Just change pruebaFiddler.txt to pruebaFiddler.saz and Captures.txt to Captures.rar

former_member190719
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Bruce

I'm a little bit lost here.

The TCPTrace does not show the "Unable to translate byte [F3]... ", only PowerBuilder gets that.

If I run the TCPTrace on the server it returns:

former_member190719
Active Contributor
0 Kudos

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>&#xD;

Server stack trace: &#xD;

   at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)&#xD;

   at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index)&#xD;

   at System.Text.DecoderFallbackBuffer.InternalFallback(Byte[] bytes, Byte* pBytes, Char*&amp; chars)&#xD;

   at System.Text.UTF8Encoding.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, DecoderNLS baseDecoder)&#xD;

   at System.Text.UTF8Encoding.GetChars(Byte[] bytes, Int32 byteIndex, Int32 byteCount, Char[] chars, Int32 charIndex)&#xD;

   at System.Xml.ValueHandle.TryReadChars(Char[] chars, Int32 offset, Int32 count, Int32&amp; actual)&#xD;

   at System.Xml.XmlBaseReader.ReadValueChunk(Char[] chars, Int32 offset, Int32 count)&#xD;

   at System.Xml.XmlBinaryWriter.WriteTextNode(XmlDictionaryReader reader, Boolean attribute)&#xD;

   at System.Xml.XmlDictionaryWriter.WriteNode(XmlDictionaryReader reader, Boolean defattr)&#xD;

   at System.ServiceModel.Channels.ReceivedFault.CreateFault11(XmlDictionaryReader reader, Int32 maxBufferSize)&#xD;

   at System.ServiceModel.Channels.MessageFault.CreateFault(Message message, Int32 maxBufferSize)&#xD;

   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; rpc)&#xD;

   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)&#xD;

   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)&#xD;

   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)&#xD;

&#xD;

Exception rethrown at [0]: &#xD;

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)&#xD;

   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)&#xD;

   at signature.SgSignToolsWSPortType.ProcessMessage(ProcessMessageRequest request)&#xD;

   at signature.SgSignToolsWSPortTypeClient.signature.SgSignToolsWSPortType.ProcessMessage(ProcessMessageRequest request)&#xD;

   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&#xD;

   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&amp; as_idproceso, PBString&amp; 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&#xD;

   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&amp; as_idproceso, PBString&amp; 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&#xD;

   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&#xD;

   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&#xD;

   at bcfews.c__uo_bcfews.autenticarevid_4_524696403(c__str_bcfeautenticardocrequest astr_datos, PBArray abt_doctoorig, PBArray abt_doctofirmado, PBArray&amp; 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&#xD;

   at bcfeWS.uo_bcfews.autenticarEvid(str_bcfeautenticardocrequest astr_datos, Byte[] abt_doctoorig, Byte[] abt_doctofirmado, str_bcfefirmante[]&amp; astr_firmantes) in c:\Users\cperez\Documents\GT\Padron de Certificados e Interfaz\LibNet\bcfeWS\bcfews.out\bcfews_uo_bcfews_wrapper.cs:line 172&#xD;

   at SyncInvokeautenticarEvid(Object , Object[] , Object[] )&#xD;

   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)&#xD;

   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&amp; rpc)&#xD;

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)&#xD;

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)&#xD;

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)&#xD;

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)&#xD;

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&amp; rpc)&#xD;

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)&#xD;

   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.Reflection.TargetInvocationException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>

Former Member
0 Kudos

Sorry Bruce when you said "TCPTrace" I thought "TCPTrace the app", not the log which I got with Fiddler.    (dah!)

former_member190719
Active Contributor
0 Kudos

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?

Former Member
0 Kudos

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.

former_member190719
Active Contributor
0 Kudos

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).

Former Member
0 Kudos

And I would be able to see that in Powerbuilder .Net?, 'cause I already know the exact message I should be getting on PB, but can catch it to returning and display it or log it.

Former Member
0 Kudos

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

Former Member
0 Kudos

At least I'm not alone...

Former Member
0 Kudos

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

former_member190719
Active Contributor
0 Kudos

Correct, that, and provide a trace of the return from the web service so we know what exactly it is that the web service is returning.

Former Member
0 Kudos

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  
---------------------------

Former Member
0 Kudos

I already done that, and I'm getting a different message (on the original post).

I add some images so you can see.

TCP Trace:

Powerbuilder:

former_member190719
Active Contributor
0 Kudos

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?

former_member190719
Active Contributor
0 Kudos

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:

http://blogs.msdn.com/b/itasupport/archive/2010/11/22/wcf-supported-charsets-and-unable-to-translate...

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.

Former Member
0 Kudos

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:

WCFBasicHttpBinding Class

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.

Properties

WCFBasicHttpBinding propertyTypeDescription
TransferModeWSTransferMode (enumeration)Gets or sets a value to indicate whether messages are buffered or streamed. Values are: BUFFERED(default), STREAMED, STREAMEDREQUEST, and STREAMEDRESPONSE.
MessageEncodingWSMessageEncoding (enumeration)Specifies encoding for SOAP messages. Values are: Text (default), and MTOM (Message Transmission Optimization Mechanism).
TextEncodingWSTextEncoding (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? :'(