I have just started out with PowerShell and SOAP Webservices.
I'm using New-WebserviceProxy and I have trouble finding the correct number of arguments for a query.
The service method I'm trying to use looks like this:
<xs:element name="GetCases">
<xs:complexType>
<xs:sequence>
<xs:element name="parameter" type="tns:GetCasesQuery" nillable="true" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="GetCasesQuery">
<xs:sequence>
<xs:element name="ADContextUser" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="AdditionalFields" type="tns:ArrayOfAdditionalFieldParameter" nillable="true" minOccurs="0"/>
<xs:element name="ArchiveCode" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="CaseNumber" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="CategoryCode" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="ContactReferenceNumber" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="ExternalId" type="tns:ExternalIdParameter" nillable="true" minOccurs="0"/>
<xs:element name="IncludeCustomFields" type="xs:boolean" minOccurs="0"/>
<xs:element name="IncludeReferringCases" type="xs:boolean" minOccurs="0"/>
<xs:element name="IncludeReferringDocuments" type="xs:boolean" minOccurs="0"/>
<xs:element name="MaxReturnedCases" type="xs:int" nillable="true" minOccurs="0"/>
<xs:element name="ProjectNumber" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="Recno" type="xs:int" nillable="true" minOccurs="0"/>
<xs:element name="Title" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="IncludeAccessMatrixRowPermissions" type="xs:boolean" minOccurs="0"/>
<xs:element name="IncludeCaseContacts" type="xs:boolean" minOccurs="0"/>
<xs:element name="IncludeCaseEstates" type="xs:boolean" minOccurs="0"/>
<xs:element name="LastDate" type="xs:dateTime" nillable="true" minOccurs="0"/>
<xs:element name="OnlyPublicInfo" type="xs:boolean" minOccurs="0"/>
<xs:element name="Page" type="xs:int" nillable="true" minOccurs="0"/>
<xs:element name="SortCriterion" type="q4:SortCriterion" nillable="true" minOccurs="0" xmlns:q4="http://schemas.datacontract.org/2004/07/SI.Data.Contracts.WS"/>
</xs:sequence>
</xs:complexType>
To me it look's as if there are 21 arguments, however when I run the script:
$Credentials = Get-Credential
$proxy = New-WebServiceProxy -Uri $WS_CaseService -Credential $Credentials -Namespace "WebService"
$proxy.GetCases($null, $null, $null, "17/00004", $null, $null, $null, $false, $false, $false, $null, $null, $null, $null, $false, $false, $false, $null, $false, $null, $null)
I get the message "Cannot find an overload for "GetCases" and the argument count: "21".
Output from proxy.GetCases:
WebService.GetCasesResult, quutbtyz, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null GetCases(WebService.GetCasesQuery , quutbtyz, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null parameter)
If anyone could point me in the right direction I would be very happy!
Related
I have a XSD definition which looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ARTICLES">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="ARTICLE">
<xs:complexType>
<xs:sequence>
<xs:element name="NAME" type="xs:string" />
<xs:element name="TYPE" type="xs:unsignedByte" />
<xs:element name="LENGTH" type="xs:unsignedByte" />
<xs:element name="WIDTH" type="xs:unsignedShort" />
<xs:element name="HEIGHT" type="xs:unsignedShort" />
<xs:element maxOccurs="unbounded" name="PRICELIST">
<xs:complexType>
<xs:sequence>
<xs:element name="SALESCONTRACT" type="xs:string" />
<xs:element name="PRICE" type="xs:decimal" />
<xs:element name="VAT" type="xs:unsignedByte" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
An XML can contain a collection of ATRICLES and each ARTICLE can have 1 or more PRICELIST entries
Now I would like to take an element and restrict the value entries. i.e. With a regex or numbers only or in length.
With simpletype I found lots of examples that work with a pattern tag.
How would this work with complex types?
Regards,
Rick
You can simply apply all of those examples you've found using xs:simpleType to any of the parts of ARTICLE that you wish to further constrain. For example, to limit NAME to be of maximum length of 32 characters:
<xs:element name="NAME">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="32"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
I am now struggling a bit to generate automatically the XPaths leading to a certain type of my XSD schema.
In this example, I would like to get the XPath leading to "firstName" and "lastName", which means:
root/Friend/firstName, root/Friend/lastName, root/TenthGrader/firstName, root/tenthGrader/lastName, root/complicatedPerson/oldSelf/firstName, root/complicatedPerson/oldSelf/lastName
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="Friend" type="Student"/>
<xs:element name="TenthGrader">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Student">
<xs:element name="Sexyteacher"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element ref="complicatedPerson"/>
<xs:element name="IdoNothing"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="complicatedPerson" type="Person"/>
<xs:complexType name="Person">
<xs:sequence>
<xs:element name="oldSelf" type="Student"/>
<xs:element name="Age" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Student">
<xs:sequence>
<xs:element name="firstName"/>
<xs:element name="lastName"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
This is already giving me a headache.
Is there any known method to do this?
Thank you very much in advance!
Hello I have a problem with Oracle XMLDB Express Edition 10g.
I am trying to register a fully valid and working .xsd Schema via dbms_xmlschema.registerSchema, but keep getting
ORA-01741: illegal zero-length identifier
I have tried everything: triplechecked my xsd and query code.
There were a couple of topics on Oracle forums but there were no answers.
Please help.
Here is my code:
begin
dbms_xmlschema.registerSchema(
'opta',
'<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/opta/" targetNamespace="http://www.example.org/opta/">
<xs:element name="Document">
<xs:complexType>
<xs:sequence>
<xs:element name="Order" type="tns:Order" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="Order">
<xs:sequence>
<xs:element name="Products" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Product" type="tns:Product" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Date" type="xs:date" minOccurs="1"/>
<xs:element name="Client" type="tns:Client" minOccurs="1"/>
</xs:sequence>
<xs:attribute name="id" type="xs:int"/>
</xs:complexType>
<xs:complexType name="Product">
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Price" type="xs:int"/>
<xs:element name="Amount" type="xs:int"/>
<xs:element name="Producer" type="tns:Producer"/>
<xs:element name="Type" type="xs:string"/>
</xs:sequence>
<xs:attribute name="id" type="xs:int"/>
</xs:complexType>
<xs:complexType name="Producer">
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Organization" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Client">
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Organization" type="xs:string"/>
<xs:element name="Country" type="xs:string"/>
<xs:element name="City" type="xs:string"/>
<xs:element name="Address" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
');
end;
when I want to validate my xsd file, I got this error
cos-nonambig: "my xsd file":layout and "my xsd file":layout (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
and refers me to this tag
<xs:complexType name="pageType">
<xs:choice>
<xs:element type="main:layoutType" name="layout" minOccurs="0" maxOccurs="1"/>
<xs:group ref="main:WidgetsGroup" maxOccurs="unbounded" minOccurs="0"/>
</xs:choice>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:string" name="layout"/>
<xs:attribute type="xs:string" name="dataModel"/>
<xs:attribute type="xs:string" name="domain"/>
</xs:complexType>
what is the problem? and how could I fix it?
I've solved it by inserting WidgetGroup contents to my xsd as :
<xs:complexType name="pageType">
<xs:choice>
<xs:element type="main:layoutType" name="layout" minOccurs="0" maxOccurs="1"/>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="spinner" type="main:SpinnerType" minOccurs="0"/>
<xs:element name="datePicker" type="main:DatePickerType" minOccurs="0"/>
<xs:element name="button" type="main:ButtonType" minOccurs="0"/>
<xs:element name="combo" type="main:ComboBoxType" minOccurs="0"/>
<xs:element name="checkBox" type="main:CheckBoxType" minOccurs="0"/>
<xs:element name="radioButton" type="main:RadioButtonType" minOccurs="0"/>
<xs:element name="image" type="main:ImageType" minOccurs="0"/>
<xs:element name="label" type="main:LabelType" minOccurs="0"/>
<xs:element name="listBox" type="main:ListBoxType" minOccurs="0"/>
<xs:element name="textBox" type="main:TextBoxType" minOccurs="0"/>
<!--<xs:element name="layout" type="main:layoutType" minOccurs="0"/>-->
</xs:choice>
</xs:sequence>
</xs:choice>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:string" name="layout"/>
<xs:attribute type="xs:string" name="dataModel"/>
<xs:attribute type="main:domainType" name="domain"/>
<xs:attribute type="xs:string" name="title"/>
</xs:complexType>
Hi guys I have a simple XML file with this structure
... ...
<Fields>
<Field name="MainJob.Id" value="t066_id">
<Description nullable="false" type="System.Int32" />
</Field>
What I have actually is this XSD file description:
<xs:element minOccurs="0" maxOccurs="unbounded" name="Fields">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Field">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Description">
<xs:complexType>
<xs:attribute name="nullable" type="xs:string" use="required" /> <xs:attribute name="type" type="xs:string" use="required" />
<xs:attribute name="minLength" type="xs:string" use="optional" />
<xs:attribute name="maxLength" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="value" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
How I can define two only available values for the attribute nullable, like 'true' and 'false'?
If I nest a SimpleType inside the attribute the .XSD file is not valid anymore.
thank you
Type should be not xs:string but xs:boolean for your example, or you can use enumeration (example).
You can add a simpleType like so:
<xs:simpleType name="TrueOrFalse">
<xs:restriction base="xs:string">
<xs:enumeration value="false"/>
<xs:enumeration value="true"/>
</xs:restriction>
</xs:simpleType>
and then change your nullable to:
<xs:attribute name="nullable" type="TrueOrFalse" use="required" />
Marc