Confessions of a Dangerous Mind

Brain.FlushBuffer()
posts - 91, comments - 166, trackbacks - 315

WSE 2.0 Bug!

Ultimamente sto lavorando su un progetto che mi ha portato ad utilizzare un'architettura SOA che si basa su WSE per mettere in sicurezza le comunicazioni. Utilizzo dataset per lo scambio dei dati tra tier, e così facendo mi sono accorto di uno strano comportamento che si verifica solamente nel caso in cui ci si trovi nelle seguenti condizioni:

  1. Sto effettuando una chiamata ad un Web Service che accetta come parametro un DataSet
  2. Sto utilizzando l'elemento di cifratura nella configurazione del proxy WSE
  3. Utilizzo il Framework 1.1
  4. Il dataSet che sto inviando al server contiene almeno una relazione con constraint tra due tabelle in esso contenute

L'errore è di questo tipo:

 "Impossibile leggere la richiesta. --> Errore nel documento XML (1, 3491). --> Vincolo di identità 'http://tempuri.org/WSEBug/Service1:Orders_Constraint1' non dichiarato. Errore in , (1, 3283)." String

Indagando ulteriormente, ho realizzato un'applicazione per verificare le condizioni in cui questo errore si verifica. E' da notare come la richiesta fatta dal client non raggiunga neppure l'endpoint SOAP da me specificato, bensì si fermi prima. Creando un filtro input SOAP (SoapInputFilter) sono riuscito ad intercettare la richiesta e la differenza tra i due messaggi è minima, ma c'è! A seguire riporto  i due messaggi: prima quello "buono", poi quello "cattivo":

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

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><soap:Header>

<wsa:Action>http://tempuri.org/WSEBug/Service1/PutOrder</wsa:Action>

<wsa:MessageID>uuid:eb11066b-3ef0-440e-bbac-223ad20c697f</wsa:MessageID>

<wsa:ReplyTo>

<wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>

</wsa:ReplyTo>

<wsa:To>http://localhost/WSEBUG/WSOrder.asmx</wsa:To>

</soap:Header>

<soap:Body>

<PutOrder xmlns="http://tempuri.org/WSEBug/Service1">

<order>

<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="it-IT">

<xs:complexType>

<xs:choice maxOccurs="unbounded">

'Envelope che causa l'errore

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

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">

<soap:Header>

<wsa:Action>http://tempuri.org/WSEBug/Service1/PutOrder</wsa:Action>

<wsa:MessageID>uuid:93c85e29-c5b2-497e-ab59-1d7a918da515</wsa:MessageID>

<wsa:ReplyTo>

<wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>

</wsa:ReplyTo>

<wsa:To>http://localhost/WSEBUG/WSOrder.asmx</wsa:To>

</soap:Header>

<soap:Body>

<PutOrder xmlns="http://tempuri.org/WSEBug/Service1">

<order>

<xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="it-IT">

<xs:complexType>

<xs:choice maxOccurs="unbounded">

Giusto per non giocare a "Trova le differenze", ho evidenziato l'attributo mancante all'interno dell'envelope. Si tratta di un elemento xmlns="", presente nella versione che non dà errori, assente nella versione con errori. La buona notizia è che con le seguenti righe di codice all'interno del filtro il problema si risolve:

'hack to insert the attribute xmlns="" (missing if you use the WSE crypt)

'Dim _schema As XmlNode = envelope.DocumentElement.ChildNodes(1).FirstChild.FirstChild.FirstChild()

'If _schema.Name = "xs:schema" Then

' Dim _att As XmlAttribute = envelope.CreateAttribute("xmlns")

' _schema.Attributes.Append(_att)

'End If

L'altra buona notizia è che se si utilizza il framework 2.0 per far girare il Web Service l'errore scompare. Probabilmente il baco è già stato individuato e risolto. Buon per noi!

 

Print | posted on venerdì 22 aprile 2005 10.23 | Filed Under [ Bugs! ]

Feedback

Gravatar

# re:WSE 2.0 Bug!

^_~,pretty good!csharpsseeoo
08/05/2005 9.27 | 绝缘电阻测试仪
Gravatar

# re:WSE 2.0 Bug!

WSE 2.0 Bug!ooeess
30/05/2005 17.28 | 推拉力测试仪
Gravatar

# re:WSE 2.0 Bug!

WSE 2.0 Bug!ooeess
12/07/2005 1.33 | 红外热像仪
Gravatar

# Tavares

London-born rapper Sway is to be honoured at the BET Hip-Hop awards in the US.
15/08/2007 13.03 | Joseph Ruby
Gravatar

# Kaiser

Singer George Michael lends the piano on which John Lennon wrote Imagine to an anti-war exhibition.
15/08/2007 13.04 | Amarion Monroe
Gravatar

# High

The Red Hot Chili Peppers are leading the way at this years MTV Europe music awards with four nominations.
15/08/2007 13.05 | Quinton Felder
Gravatar

# Whittington

William Styron, whose Holocaust novel Sophie's Choice became a film and an opera, has died, aged 81.
15/08/2007 13.21 | Glenn Bradshaw
Gravatar

# Gorman

Social networking site MySpace is to block users from uploading copyrighted music to its pages.
15/08/2007 13.22 | Antonio David
Gravatar

# Whitlock

Pop trio Atomic Kitten will reform to play a concert in support of jailed Liverpool football fan Michael Shields.
15/08/2007 13.36 | Dangelo Chadwick
Gravatar

# Houghton

Microsoft and Peter Jackson postpone the making of a film based on the Halo video game after backers pull out.
15/08/2007 13.39 | Alden Pacheco
Gravatar

# Sipes

A musical about the witches from The Wizard of Oz breaks West End box office records, its producers say.
15/08/2007 13.53 | Devin Gallant
Gravatar

# Hare

The Rolling Stones cancel a gig in Hawaii and postpone other tour dates as Mick Jagger suffers throat troubles.
15/08/2007 13.56 | Porter Dillard
Gravatar

# Olvera

Classical singer Russell Watson postpones his forthcoming UK tour after undergoing brain surgery.
15/08/2007 13.59 | Reilly Bustamante
Gravatar

# Furr

Alec Baldwin asks for his voice to be removed from an &amp;quot;unfair&amp;quot; documentary about Arnold Schwarzenegger.
15/08/2007 14.26 | Tyrone Matney
Gravatar

# Kessler

Jonathan Ross is dubbed &amp;quot;risque&amp;quot; by Ofcom but not in breach of rules over an interview with David Cameron.
15/08/2007 14.43 | Abel Ortega
Gravatar

# Baird

The judge who put coded messages in his Da Vinci Code plagiarism trial ruling has written another.
15/08/2007 14.58 | Moses Meeks
Gravatar

# Woody

Record company EMI sign a deal with the estate of crooner Dean Martin to use the singer's likeness.
15/08/2007 15.01 | Jonas Monahan
Gravatar

# Wingfield

Doctor Who takes three prizes at the National Television Awards in a repeat of its success last year.
15/08/2007 15.16 | Geoffrey Lohr
Gravatar

# Passmore

Borat creator Sacha Baron Cohen reportedly signs a $42.5m (22m) film deal starring his character Bruno.
15/08/2007 15.33 | Efren Dolan
Gravatar

# Singer

Pioneering screenwriter Nigel Kneale, best known for the Quatermass TV serials and films, dies aged 84.
15/08/2007 15.38 | John Mickens
Gravatar

# Creighton

Colombia's vice president is &amp;quot;baffled&amp;quot; by Kate Moss's success following cocaine allegations.
15/08/2007 15.50 | Alejandro Burke
Gravatar

# Aranda

TV host Oprah Winfrey gives audience members $1,000 (526) each to donate to a charitable cause.
15/08/2007 15.52 | Marcos Mcwhorter
Gravatar

# Woodruff

The first stage of a 150m investment in regional museums is praised for boosting visitor numbers.
15/08/2007 16.14 | Rodrigo Rosales
Gravatar

# Baxley

Veteran game show host Bob Barker is stepping down from hosting The Price is Right after 35 years.
15/08/2007 16.32 | Jessie Rushing
Gravatar

# Lai

The Rolling Stones postpone a show in the US to allow singer Sir Mick Jagger time to rest his voice.
15/08/2007 17.44 | Travon Schell
Gravatar

# Theriault

Veteran actor William Franklyn, known for voicing the 1960s Schweppes TV adverts, dies aged 81.
15/08/2007 19.20 | Finn Pogue
Gravatar

# Pinckney

Madonna says she may adopt another child from abroad following her proposed adoption of a Malawian boy.
15/08/2007 20.21 | Nathanial Mcintire
Gravatar

# bjszraup

bjszraup
15/10/2007 3.57 | bjszraup
Gravatar

# ikgzgufc - Google Search

ikgzgufc - Google Search
15/10/2007 3.57 | Pingback/TrackBack

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 1 and 4 and type the answer here:

Powered by: