Dynamic Routing with WSHttp-WCF

hi, Im trying to dynamically routing a message to a WSHttp-Wcf send port, with certificates.

Below is the code to do that:

MessageTest.parameters = Message_2;

MessageTest(WCF.Action) = "http://tempuri.org/IService/SendInvoice";

MessageTest(WCF.SecurityMode) = "Message";

MessageTest(WCF.TransportClientCredentialType) = "Certificate";

MessageTest(WCF.AlgorithmSuite) = "Basic256";

MessageTest(WCF.NegotiateServiceCredential) = false;

MessageTest(WCF.EstablishSecurityContext) = false;

MessageTest(WCF.ClientCertificate) = BrokerUtilities.RepositoryHelper.GetCertificateBySubject("RP", false);

MessageTest(WCF.ServiceCertificate) = BrokerUtilities.RepositoryHelper.GetCertificateBySubject("bizabiza", true);

MessageTest(WCF.Identity) = "AwAAAAEAAAAUAAAAK9kkbxDf+tJgMBrX0Pu+63ad9IEgAAAAAQAAAN0BAAAwggHZMIIBRqADAgECAhCTH89SFhbrjEh+vyb3hRs5MAkGBSsOAwIdBQAwDTELMAkGA1UEAxMCUlAwHhcNMDYxMDA5MjMwMDAwWhcNMDgxMDA5MjMwMDAwWjANMQswCQYDVQQDEwJSUDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAsUSHt+AN1adStMRlagCIS2/4ee6ICnCYikJpEXykqtoR7fsMC+4vY8ZELFDNuhSnF83VTO64CXkNK2YilEZrphlvLm/k2csJDT6zlkYlR6Cv+VDiojH817es1XaAq7BGuDlnsDpmvSR/JYpTUNRwgVgxRpVnA2U5G/NzV+uNHh0CAwEAAaNCMEAwPgYDVR0BBDcwNYAQyRBAt8avNkYT4eJIX9/5sqEPMA0xCzAJBgNVBAMTAlJQghCTH89SFhbrjEh+vyb3hRs5MAkGBSsOAwIdBQADgYEAHEk56kI3Lxfrm0dwRKzTyaXtJawzYg4j3pXyM5Ip0vIxwZJY25gM0L6tXP9Aj+55B8Qd43y6w7W6Ok1r08NsWeiyGn3wuBIFjps6LlHWWw2aMtglSFVAOb1tjwxxgZEzMvW4Z5iaDGQDWujR/hZH1O0quH6ZYb8aiq4ScC9uPYQ=";

MessageTest(BTS.OutboundTransportType) = "WCF-WSHttp";

MessageTest(WCF.MessageEncoding) = "Text";

MessageTest(WCF.TextEncoding) = "utf-8";

MessageTest(WCF.PropagateFaultMessage) = true;

DynamicResponsePort(Microsoft.XLANGs.BaseTypes.Address) =http://localhost:8080/pl/ep1;

I had already configured a static send port with same properties and it had send the message, but in this case biztalk genreate an error.

A message sent to adapter "WCF-WSHttp" on send port "BrokerMessaging_1.0.0.0_BrokerMessaging.InvoiceResponse_DynamicResponsePort_f4c8b2752825e9a1" with URI "http://localhost:8080/pl/ep1" is suspended.

Error details: 'Text' is an invalid XmlNodeType. Line 1, position 1.

MessageId: {7DB5148D-C5D5-481E-9760-4C336E99EC2E}

InstanceID: {6012268C-ACBD-423E-BA31-8803FD08A7AC}

Can someone help me? Thanks

[2713 byte] By [BrunoSequeira] at [2008-1-8]
# 1

Hi Bruno,

It would be easier if we had the call stack info. Can you take a look at your suspended instance and post the text from the Error Information tab?

and can you also try simplifying your scenario by using the "None" security mode and removing the certicates to see if there is an issue with the certs?

Thanks,

Karahan

KarahanCelikel-MSFT at 2007-10-2 > top of Msdn Tech,BizTalk Server,BizTalk R2 Adapters and Adapter Pack...
# 2

Hi Karahan,

the error from the Error Information tab of the supended instance is the same:

Error Code: 0xc0c0167a (Transmission Failure)

Error Description: "'Text' is an invalid XmlNodeType. Line 1, position 1."

I will try to build a scenario without certificates but i think that certs is not the problem. I had already create a wcf client and service, without biztalk, with the same certs and it send and return messages with no problems.′

I used a static Wshttp-wcf port to send the same message, with same certs, to an aplication service. The message is signed and encrypted and is send to the service successfully, but appears a strange warning in event viewer:

The adapter failed to transmit message going to send port "SendPort4" with URL "http://localhost:8080/pl/ep1". It will be retransmitted after the retry interval specified for this Send Port. Details:"The 'Body', 'http://www.w3.org/2003/05/soap-envelope' required message part was not encrypted.".

The service receives the message but biztalk cant receive the return from the call of the remote procedure...it is odd!

Bruno

BrunoSequeira at 2007-10-2 > top of Msdn Tech,BizTalk Server,BizTalk R2 Adapters and Adapter Pack...
# 3

Sorry Karahan,

i post the error that results the transmission error but forgot to post the error of the same instance originated in the orchestration:

Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'BrokerMessaging.Process(31c4829f-b245-7314-34b5-11622109ea1a)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 71053a0c-af87-4feb-b396-2ad22b0079ce
Shape name:
ShapeId: a3c52215-5d65-4053-9657-11954c9c929d
Exception thrown from: segment -1, progress -1
Inner exception: Object reference not set to an instance of an object.

Exception type: NullReferenceException
Source: BrokerMessaging
Target Site: Microsoft.XLANGs.Core.StopConditions segment4(Microsoft.XLANGs.Core.StopConditions)
The following is a stack trace that identifies the location where the exception occured

at BrokerMessaging.InvoiceResponse.segment4(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, E

BrunoSequeira at 2007-10-2 > top of Msdn Tech,BizTalk Server,BizTalk R2 Adapters and Adapter Pack...
# 4

It looks like the exception is coming from your component.

Exception type: NullReferenceException
Source: BrokerMessaging

Can you debug into your component and see why it's throwing a NullReferenceException?

KarahanCelikel-MSFT at 2007-10-2 > top of Msdn Tech,BizTalk Server,BizTalk R2 Adapters and Adapter Pack...
# 5

This error appears cause there is no return message in my wcf port! I debug it but my component shows nothing about this error. I think the problem is in WCF adapter....something is missing in the configuration...some wcf context atribute...i dont know!

Bruno

BrunoSequeira at 2007-10-2 > top of Msdn Tech,BizTalk Server,BizTalk R2 Adapters and Adapter Pack...
# 6

Hi Bruno,

It's strange that you're not seeing the exception when debugging your component although the stack explicity refers to the BrokerMessaging as the source.

Can you enable WCF message logging and see the actual message returned by the remote service?

You can enable WCF message logging by having a app.config file similar to the following, and use SvcTraceViewer.exe to view the log.

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<system.serviceModel>

<diagnostics performanceCounters="All">

<messageLogging

logEntireMessage="true"

logMalformedMessages="false"

logMessagesAtServiceLevel="true"

logMessagesAtTransportLevel="true"

maxMessagesToLog="300000"

maxSizeOfMessageToLog="200000"

/>

</diagnostics>

</system.serviceModel>

<system.diagnostics>

<sources>

<source name="System.ServiceModel.MessageLogging">

<listeners>

<add name="messages"

type="System.Diagnostics.XmlWriterTraceListener"

initializeData="c:\log.xml" />

</listeners>

</source>

</sources>

</system.diagnostics>

</configuration>

KarahanCelikel-MSFT at 2007-10-2 > top of Msdn Tech,BizTalk Server,BizTalk R2 Adapters and Adapter Pack...