How to create a valid schema in a WSDL that restrict to <|<=|>|>= - wsdl

This is what I have in my schema section of my WSDL to specify the field has to be comparison operators
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="<|>|<=|>=|="/>
</xsd:restriction>
</xsd:simpleType>
SoapUI complains about this part of the WSDL, I tried to set the value to something with non special characters and the WSDL is valid. So I tried to replace that whole long string to be
value=">gt;" and it valid but value="<lt;" is not valid, and value=">" is also not valid. My question is, why does the WSDL validation need > to be double escaped?
The main question is, how to provide a valid less than side within the pattern value.

This might actually be a bug in SoapUI. I tried using the following schema and XML with Apache Xalan (in Java):
Schema:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.foo.com/"
xmlns:tns="http://www.foo.com/"
elementFormDefault="qualified">
<element name="foo">
<simpleType>
<restriction base="string">
<pattern value="<|>|<=|>=|="/>
</restriction>
</simpleType>
</element>
</schema>
Sample XML:
<foo xmlns='http://www.foo.com/'>></foo>
and it validates fine. When I try this instead:
<foo xmlns='http://www.foo.com/'>abc</foo>
I get the following error, as expected: cvc-pattern-valid: Value 'abc' is not facet-valid with respect to pattern '<|>|<=|>=|=' for type '#AnonType_foo'.
My recommendation is to try using an enum instead. For example:
<simpleType>
<restriction base="string">
<enumeration value="<" />
<enumeration value=">" />
<enumeration value="<=" />
<enumeration value=">=" />
<enumeration value="=" />
</restriction>
</simpleType>
And see if SoapUI likes this better. Hope this helps!

I think I solved my own problem, why would you define in your schema that one of the allowable value is
<xsd:restriction base="xsd:string">
<xsd:pattern value="=|&gt;|&gt;=|&lt;|&lt;=|&lt;&gt;|[Ii][Nn]|[Nn][Oo][Tt] [Ii][Nn]|[Ll][Ii][Kk][Ee]"/>
</xsd:restriction>

Related

xf:submission: Populate Header Value From Current Context

I'm wanting to populate the header in a xf:submission with a value from the current context. Documentation says that an xpath expression can be used but doesn't provide any examples.
I've tried using xsl:value, seen below, but that doesn't populate anything. Is that the correct syntax to populate xf:value?
<p:for-each href="#attachments" select="//attachment" root="attachments" id="post-document-pages">
<p:processor name="oxf:xforms-submission">
<p:input name="submission">
<xf:submission
method="post"
resource="http://localhost:8080/is/document/{#documentId}/page"
serialization="application/octet-stream">
<xf:header>
<xf:name>Resource-Name</xf:name>
<xf:value>
<xsl:value-of select="#filename" />
</xf:value>
</xf:header>
</xf:submission>
</p:input>
<p:input name="request" href="current()" />
<p:output name="response" ref="post-document-pages" />
</p:processor>
Inside the <xf:header>, simply use:
<xf:value value="[your XForms expression here]"/>

NHibernate mapping. Class name the same as property name

In my NHibernate mapping file I've had two classes mapped where one classes property had the same name as another classes name (Group).
<class name="Machine" table="SpisMaszyn" dynamic-update="true">
<cache usage ="read-write"/>
<id name="ID" column="ID" type="int">
<generator class="native" />
</id>
<property column="NazwaMaszyny" name="MachineName" />
<property column="Grupa" name="Group" />
</class>
<class name="Group" table="SpisGrup" dynamic-update="true">
<cache usage ="read-write"/>
<id name="ID" column="ID" type="int">
<generator class="native" />
</id>
<property name="Name" column="Nazwa" />
</class>
I don't know why but if the names are the same the code wasn't working properly. In my ModelState I was getting null value for Group. I'm not sure what can be causing it.
Do you have any idea what might cause this ?
The mapping is correct. A fact that some property and some other class name share same name, is not any issue for NHibernate. Check the underlying column content. Run profiler to see the SQL Query and assure that returned data are there...
original assumpiton that many-to-one is required removed

SoapUI seems to be incorrectly saying these restrictions are invalid. What am I doing wrong?

I have the following in my XML Schema:
<xsd:simpleType name="DECIMAL_TYPE">
<xsd:restriction base="xsd:double">
<xsd:minInclusive value="-100000"/>
<xsd:maxInclusive value="100000"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ANGLE_VALUE_TYPE">
<xsd:restriction base="DECIMAL_TYPE">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="360"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="ANGLE_TYPE">
<xsd:simpleContent>
<xsd:extension base="ANGLE_VALUE_TYPE">
<xsd:attribute name="UNITS" type="xsd:string" fixed="degrees"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="SPECIAL_ANGLE_TYPE">
<xsd:simpleContent>
<xsd:restriction base="ANGLE_TYPE">
<xsd:maxInclusive value="90" /> <!-- The source of the problem -->
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
This schema is used in a WSDL that I'm using as the basis for a new SoapUI project. However, when I try to import the project, SoapUI gives this error:
There was something wrong with the WSDL you are trying to import:
Source: null
Error: Must be less than or equal to previous maxInclusive
If I change the '90' in the problem line to be equal to '360', the same error appears.
If I remove the line with the comment ("The source of the problem") then SoapUI imports the WSDL just fine. The schema successfully validates in Eclipse, and WSDL2Java runs fine on it.
What, if anything, is wrong with my schema, and what do I need to do to import this to SoapUI? Thank you!
I wonder if your problem is related to the fact that ANGLE_TYPE names ANGLE_BASE_TYPE as its base type, but your schema fragment has no declaration for such a type.
When I change the declaration to name ANGLE_VALUE_TYPE, both Saxon and Xerces tell me the schema document is valid, and once augmented with some element declarations it seems to behave as desired.

Iterating an array using Mule's foreach scope

I would like to iterate through an array and use the value taken from the array to put it within an http inbound endpoint. How would I be able to iterate through this array and take the value from the array to place it as a variable within the http inbound endpoint?
The code that I used to try was:
<flow name="foreachFlow1" doc:name="foreachFlow1">
<poll frequency="2000">
<foreach collection="#[groovy:['localhost:8082', 'localhost:8083']]"
doc:name="For Each">
<http:outbound-endpoint exchange-pattern="request-response"
address="http://#[payload]" method="GET" doc:name="HTTP" />
</foreach>
</poll>
</flow>
and I get the error
Invalid content was found starting with element 'poll'
Inbound endpoints are message sources and can not be parametrized the way you're describing.
To achieve your goal, trying a <poll> message source to wrap a foreach that uses http:outbound-endpoint to perform GET (#method) request-response (#exchange-apttern) interactions.
The trick is to bring the results for the HTTP calls back through the foreach, which by default do not do it. The following illustrate a potential approach:
<flow name="foreachFlow1">
<poll frequency="2000">
<processor-chain>
<set-variable variableName="httpResponses" value="#[[]]" />
<foreach collection="#[groovy:['localhost:8082', 'localhost:8083']]">
<http:outbound-endpoint
exchange-pattern="request-response" address="http://#[payload]"
method="GET" />
<expression-component>httpResponses.add(message.payloadAs(java.lang.String))
</expression-component>
</foreach>
</processor-chain>
</poll>
<logger level="INFO" message="#[httpResponses]" />
</flow>
<!-- Test server stubs -->
<flow name="server8082">
<http:inbound-endpoint exchange-pattern="request-response"
address="http://localhost:8082" />
<set-payload value="This is 8082" />
</flow>
<flow name="server8083">
<http:inbound-endpoint exchange-pattern="request-response"
address="http://localhost:8083" />
<set-payload value="This is 8083" />
</flow>

How to read ID from XSOM XSElementDecl

veI am using XSOM in Java to parse an XSD. It's working really well but there's one piece of information from an element that I just can't seem to get hold of - namely the "id" attribute.
One of my elements looks like this :-
<xsd:element name="ACCOUNTTITLE1" minOccurs="0" id="ACCOUNT.TITLE.1" nillable="true">
<xsd:annotation>
<xsd:documentation>ACCOUNT.TITLE.1</xsd:documentation>
<xsd:appinfo>
<hfp:hasProperty name="fielddatatype" value=""/>
<hfp:hasProperty name="fieldname" value="ACCOUNT.TITLE.1"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="35"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
Here I am trying to retrieve the "ACCOUNT.TITLE.1" text stored in the "id" part of the xsd:element.
Any ideas ?
A safe alternative would also to retrieve it from the "xsd:appinfo" section "fieldname" property. However, I can't see how to get hold of that either!
Any help appreciated.
Sarah

Resources