ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » xsi:type generation

Post new topic  Reply to topic Goto page 1, 2  Next
 xsi:type generation « View previous topic :: View next topic » 
Author Message
jfrankman
PostPosted: Wed Nov 25, 2009 4:14 pm    Post subject: xsi:type generation Reply with quote

Apprentice

Joined: 18 Jun 2009
Posts: 36

I am calling a web service that must have the xsi:type attribute on one of the xml elements sent to it as follows:

Code:
         <ns9:requestFNOL
            xsi:type="ns9:CreateFNOLQuestERSRequest"
            xmlns:ns9="http://entity.webservices.cc.guidewire.com/">

I have tried to set the "OutputPolicy for xsi:type attributes on the message set to always, but this does not have any affect. I have also tried to force it using ESQL:

Code:
Set OutputRoot.SOAP.Body.gwapi:createQuestERSFNOL.gwentity:requestFNOL.(XMLNSC.Attribute)xsi:type='ns9:CreateFNOLQuestERSRequest';
SET OutputRoot.SOAP.Body.gwapi:createQuestERSFNOL.gwentity:requestFNOL.(XMLNSC.NamespaceDecl)xmlns:ns9=gwentity;
Set OutputRoot.SOAP.Body.gwapi:createQuestERSFNOL.gwentity:requestFNOL.(XMLNSC.Attribute)xsi:type='ns9:CreateFNOLQuestERSRequest';


But this produces:
Code:
<ns9:requestFNOL
            xmlns:NS4="http://www.w3.org/2001/XMLSchema-instance/"
            NS4:type="ns9:CreateFNOLQuestERSRequest"
            xmlns:ns9="http://entity.webservices.cc.guidewire.com/">

which also fails. So, my question is how do you force the xsi:type attribute to be included in a SOAP or XMLNSC message?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Nov 25, 2009 4:54 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Well, did you try and add the xsi namespace declaration to your list of namespace declarations before using it?
Like at the level of OutputRoot.SOAP.Body?
Code:

SET OutputRoot.SOAP.Body.(XMLNSC.NamespaceDecl)xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance/';
....
SET Output.Root.SOAP.Body.gwapi:createQuestERSFNOL.gwentity:requestFNOL.(XMLNSC.Attribute)xsi:type='ns9:CreateFNOLQuestERSRequest'





_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Thu Nov 26, 2009 1:41 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I have tried to set the "OutputPolicy for xsi:type attributes on the message set to always, but this does not have any affect.
No surprise there - XMLNSC does not even *look* at the message set properties. Recent toolkits do a better job of highlighting this fact.

fjp_saper's suggestion is correct - treat xsi:type exactly like any other attribute.
Back to top
View user's profile Send private message
jfrankman
PostPosted: Mon Nov 30, 2009 9:29 am    Post subject: Thanks. Reply with quote

Apprentice

Joined: 18 Jun 2009
Posts: 36

The supplied example worked. Although I had to remove the trailing "/" from the namespace. I don't know why this would matter, but apparently the web service I was calling would only accept it without a trailing forward slash.

Thanks for the help.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Nov 30, 2009 1:53 pm    Post subject: Re: Thanks. Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

jfrankman wrote:
The supplied example worked. Although I had to remove the trailing "/" from the namespace. I don't know why this would matter, but apparently the web service I was calling would only accept it without a trailing forward slash.

Thanks for the help.


XML Namespaces are very specific. They have to match exactly - the trailing slash meant it was a different namespace than the one the web service was expecting.
Back to top
View user's profile Send private message
GeneRK4
PostPosted: Mon Jan 05, 2015 7:58 am    Post subject: Reply with quote

Master

Joined: 08 Jul 2013
Posts: 220

I have tried the same thing both as namespace declaration and as context but its not working for us.

As Namespace declaration:
SET OutputRoot.SOAP.Body.(XMLNSC.NamespaceDecl)xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.SOAP.Body.(XMLNSC.NamespaceDecl)xmlns:ns_tar='urn:sobject.enterprise.soap.sforce.com';
SET OutputRoot.SOAP.Body.(XMLNSC.NamespaceDecl)xmlns:ns='urn:enterprise.soap.sforce.com';
SET OutputRoot.SOAP.Body.ns:upsert.ns:sObjects.(XMLNSC.Attribute)xsi:type='ns_tar:Requisition__c';
---- SET refOut.ns_tar:Id='1';

SET OutputRoot.SOAP.Body.ns:upsert.ns:sObjects.ns_tar:Car_Allowance__c= SUBSTRING(refIn.*:Requisition.*:"Company_Car" FROM 1 FOR 20);
SET refOut.ns_tar:Vacancy_Reference__c = refIn.*:Requisition.*:Auto_reqID;

===============================================As Context:
SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:xsi = xsi;
SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:soap_ns = soap_ns;
SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:ns = ns;
SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:ns_tar = ns_tar;

SET OutputRoot.SOAP.Body.ns:upsert.ns:sObjects.ns_tar:Car_Allowance__c= SUBSTRING(refIn.*:Requisition.*:"Company_Car" FROM 1 FOR 20);

Both the tries are throwing error as below,
XML schema validation error: cvc-complex-type.2.4.e: Unexpected element. Element "ns_tar:Car_Allowance__c" is not one of the choices. Element: /XMLNSC Internal error codes: 5008

Kindly help me on this...
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jan 05, 2015 9:08 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So, to sum up, you shouldn't include "ns:tar" in the xsi:type value.

You should include the full namespace.
Back to top
View user's profile Send private message
GeneRK4
PostPosted: Mon Jan 05, 2015 5:34 pm    Post subject: Reply with quote

Master

Joined: 08 Jul 2013
Posts: 220

mqjeff wrote:
So, to sum up, you shouldn't include "ns:tar" in the xsi:type value.

You should include the full namespace.


I have tried that also like below,
SET OutputRoot.SOAP.Body.ns:upsert.ns:sObjects.(XMLNSC.Attribute)xsi:type='urn:sobject.enterprise.soap.sforce.com:Requisition__c';

instead of,
SET OutputRoot.SOAP.Body.ns:upsert.ns:sObjects.(XMLNSC.Attribute)xsi:type='ns_tar:Requisition__c';

Its throwing error as 'urn:sobject.enterprise.soap.sforce.com:Requisition__c' is not appropriate for the Qname
Back to top
View user's profile Send private message
GeneRK4
PostPosted: Mon Jan 05, 2015 7:26 pm    Post subject: Reply with quote

Master

Joined: 08 Jul 2013
Posts: 220

Whether this might be problem due to referring "urn" in xsi:type?
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jan 06, 2015 12:55 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

The error message is:
Quote:
Element "ns_tar:Car_Allowance__c" is not one of the choices.
This error is emitted IF a choice group or an xs:any or an element with type xs:anyType is encountered, AND the tag that is found is not a valid match for the choice/xs:any.
So I don't think this is connected to the xsi:type attribute. I think your document doesn't match the structure of the schema. Can you quote the relevant section(s) of the schema?
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
GeneRK4
PostPosted: Tue Jan 06, 2015 2:39 am    Post subject: Reply with quote

Master

Joined: 08 Jul 2013
Posts: 220

Hi Kimbert,
Here is the section of the field:
Code:
<complexType name="Requisition__c">
            <complexContent>
               <extension base="ens:sObject">
                  <sequence>
                       <element name="Car_Allowance__c" nillable="true" minOccurs="0" type="xsd:string"/>


The below request sent from SOAPUI tool is being accepted by the WSDL in SOAPInput node when content and value is enabled for validation.

Code:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">
   <soapenv:Header>
     </soapenv:Header>
   <soapenv:Body>
      <urn:upsert>       <urn:externalIDFieldName>Vacancy_Reference__c</urn:externalIDFieldName>
           [b] <urn:sObjects xsi:type="urn1:Requisition__c">[/b]               [b]<urn1:Car_Allowance__c>Fleet Car</urn1:Car_Allowance__c>[/b]<urn1:Status__c>Open</urn1:Status__c>
           </urn:sObjects>   
      </urn:upsert>
   </soapenv:Body>
</soapenv:Envelope>


I am just trying to create same request in ESQL.Its not working...
Back to top
View user's profile Send private message
maurito
PostPosted: Tue Jan 06, 2015 4:54 am    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

GeneRK4 wrote:
The below request sent from SOAPUI tool is being accepted by the WSDL in SOAPInput node when content and value is enabled for validation.

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<urn:upsert> <urn:externalIDFieldName>Vacancy_Reference__c</urn:externalIDFieldName>
<urn:sObjects xsi:type="urn1:Requisition__c"> <urn1:Car_Allowance__c>Fleet Car</urn1:Car_Allowance__c><urn1:Status__c>Open</urn1:Status__c>
</urn:sObjects>
</urn:upsert>
</soapenv:Body>
</soapenv:Envelope>

I am just trying to create same request in ESQL.Its not working...

I would suggest you use the same namespace prefixes as in the generated message by SOAPUI, that will help you to understand where it is going wrong ( and also all the people that are trying to help you ). not easy to go back and forth through the posts trying to match namespace prefixes.
another suggestion is to turn validation OFF, see what is produced and compare with what you want to produce ( and again, if you matched the namespace prefixes, that would make the comparison a lot easier ).
Also, by turning validation OFF, you can build your message one line at the time, once you are happy with that line, move to the next one ( including the setting of the namespace declarations, etc. , then you can see what difference changing one line of code makes ).
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jan 06, 2015 6:26 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Please avoid using urn as a namespace prefix. It adds to the confusion as your namespace starts with urn:
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Jan 06, 2015 6:36 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It doesn't really matter what the namespace prefixes are, at least right now.

Can you please show a Trace node output of the message tree that your code is currently producing.

From that, you can hopefully figure out, or at least get advice on, how to adjust your code to produce the correct message tree to produce the message you are trying to produce.
Back to top
View user's profile Send private message
GeneRK4
PostPosted: Tue Jan 06, 2015 7:46 pm    Post subject: Reply with quote

Master

Joined: 08 Jul 2013
Posts: 220

This WSDL has been provided by some external vendor.Hence we cannot change the namespace from "urn"

I have taken the output of Trace node:
( ['SOAPRoot' : 0x6f2130d0]
(0x01000000:Name ):Properties = ( ['MQPROPERTYPARSER' : 0x21aefa70]
(0x03000000:NameValue):MessageSet = '' (CHARACTER)
(0x03000000:NameValue):MessageType = '' (CHARACTER)
(0x03000000:NameValue):MessageFormat = '' (CHARACTER)
(0x03000000:NameValue):Encoding = 546 (INTEGER)
(0x03000000:NameValue):CodedCharSetId = 1208 (INTEGER)
(0x03000000:NameValue):Transactional = FALSE (BOOLEAN)
(0x03000000:NameValue):Persistence = FALSE (BOOLEAN)
(0x03000000:NameValue):CreationTime = GMTTIMESTAMP '2015-01-07 02:57:41.469002' (GMTTIMESTAMP)
(0x03000000:NameValue):ExpirationTime = -1 (INTEGER)
(0x03000000:NameValue):Priority = 0 (INTEGER)
(0x03000000:NameValue):ReplyIdentifier = X'000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):ReplyProtocol = 'SOAP-AXIS2' (CHARACTER)
(0x03000000:NameValue):Topic = NULL
(0x03000000:NameValue):ContentType = 'text/xml;charset=UTF-8' (CHARACTER)
(0x03000000:NameValue):IdentitySourceType = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceToken = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourcePassword = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceIssuedBy = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedType = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedToken = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedPassword = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedIssuedBy = '' (CHARACTER)
)
(0x01000000:Name ):HTTPInputHeader = ( ['WSINPHDR' : 0x70036a00]
(0x03000000:NameValue):X-Original-HTTP-Command = 'POST http://localhost:2444/services/hr/resourcing/dataexchange/dataexport_v1_0 HTTP/1.1' (CHARACTER)
(0x03000000:NameValue):Accept-Encoding = 'gzip,deflate' (CHARACTER)
(0x03000000:NameValue):Content-Type = 'text/xml;charset=UTF-8' (CHARACTER)
(0x03000000:NameValue):SOAPAction = '"http://services/hr/resourcing/dataexchange/dataexport_v1_0/DataExchange"' (CHARACTER)
(0x03000000:NameValue):Content-Length = '494' (CHARACTER)
(0x03000000:NameValue):Host = 'localhost:2444' (CHARACTER)
(0x03000000:NameValue):Connection = 'Keep-Alive' (CHARACTER)
(0x03000000:NameValue):User-Agent = 'Apache-HttpClient/4.1.1 (java 1.5)' (CHARACTER)
(0x03000000:NameValue):X-Remote-Addr = '127.0.0.1' (CHARACTER)
(0x03000000:NameValue):X-Remote-Host = '127.0.0.1' (CHARACTER)
(0x03000000:NameValue):X-Server-Name = 'localhost' (CHARACTER)
(0x03000000:NameValue):X-Server-Port = '2444' (CHARACTER)
)
(0x01000000:Folder):SOAP = ( ['SOAP' : 0x6ffc8d00]
(0x01000000:Folder):Body = (
(0x03000102:NamespaceDecl)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance' (CHARACTER)
(0x03000102:NamespaceDecl)xmlns:ns_tar = 'urn:sobject.enterprise.soap.sforce.com' (CHARACTER)
(0x03000102:NamespaceDecl)xmlns:ns = 'urn:enterprise.soap.sforce.com' (CHARACTER)
(0x01000000:Folder )urn:enterprise.soap.sforce.com:upsert = (
(0x03000000:PCDataField)urn:enterprise.soap.sforce.com:externalIDFieldName = 'Vacancy_Reference__c' (CHARACTER)
(0x01000000:Folder )urn:enterprise.soap.sforce.com:sObjects = (
(0x03000100:Attribute )http://www.w3.org/2001/XMLSchema-instance:type = 'ns_tar:Requisition__c' (CHARACTER)
(0x03000000:PCDataField)urn:sobject.enterprise.soap.sforce.com:Car_Allowance__c = 'Ferrari' (CHARACTER)
(0x03000000:PCDataField)urn:sobject.enterprise.soap.sforce.com:Vacancy_Reference__c = '1234' (CHARACTER)
)
)
)
)
)



=======================================
Also,I switched to Gateway mode and captured the output in SOAPUI tool.If I just disable "content and value" check,its still throwing the error because EG has the WSDL and somehow its internally getting referred.
After the Gateway mode run,here is the output formed by ESQL code:

<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/">
<NS1:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns_tar="urn:sobject.enterprise.soap.sforce.com" xmlns:ns="urn:enterprise.soap.sforce.com">
<ns:upsert>
<ns:externalIDFieldName>Vacancy_Reference__c</ns:externalIDFieldName>
<ns:sObjects xsi:type="ns_tar:Requisition__c">
<ns_tar:Car_Allowance__c>Ferrari</ns_tar:Car_Allowance__c>
<ns_tar:Vacancy_Reference__c>1234</ns_tar:Vacancy_Reference__c>
</ns:sObjects>
</ns:upsert>
</NS1:Body>
</NS1:Envelope>


Expected output is:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">

<soapenv:Body>
<urn:upsert>

<urn:externalIDFieldName>Vacancy_Reference__c</urn:externalIDFieldName>
<urn:sObjects xsi:type="urn1:Requisition__c">

<urn1:Car_Allowance__c>Fleet Car</urn1:Car_Allowance__c>

</urn:sObjects>


</urn:upsert>
</soapenv:Body>
</soapenv:Envelope>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » xsi:type generation
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.