I would like to allow some of my SOAP header elements to be nillable. This is possible for body elements, but I am not sure if it is allowed from header elements.
In the sample message below, I would like to allow the MessageDateTime to be null.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://mycompany.com/repositoryservice">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/repositoryservice">
<element name="MessageDateTime" type="dateTime" />
<element name="SaveRequest">
<!-- complexType -->
</element>
</schema>
</types>
<message name="SaveRequest_Headers">
<part name="MessageDateTime" element="tns:MessageDateTime" />
</message>
<message name="SaveRequest">
<part name="parameters" element="tns:SaveRequest" />
</message>
<binding name="RepositoryServiceBinding" type="tns:IRepositoryService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="Save">
<soap:operation soapAction="http://mycompany.com/repositoryservice/Save" style="document" />
<input name="SaveRequest">
<soap:header message="tns:SaveRequest_Headers" part="MessageDateTime" use="literal" />
<soap:body use="literal" />
</input>
</operation>
</binding>
<!-- service, portType -->
</definitions>
It is allowed as long as the definition allows for it. In your case, all you have to do is add the nillable="true" to the element's definition. The result on .NET w/ WCF would look something like this:
[System.ServiceModel.MessageHeaderAttribute(Namespace="...")]
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public System.Nullable<System.DateTime> MessageDateTime;
Related
I have created a custom data list in Alfresco, and have populated its model with the desired data columns. However, when I view the list in Alfresco share, the order is completely off, and there are elements that I have not defined in the model.
I have searched extensively as to how to fix this, and have not been successful. From what I understand, I need to define the layout in the share-config-custom.xml, which I have attempted below (snippet of only what I added):
<config evaluator="model-type" condition="orpdl:orpList">
<forms>
<form>
<field-visibility>
<show id="orpdl:programName" />
</field-visibility>
<create-form template="../data-lists/forms/dataitem.ftl" />
<appearance>
<field id="orpdl:programName">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
<config evaluator="node-type" condition="orpdl:orpList">
<forms>
<form>
<field-visibility>
<show id="orpdl:programName" />
</field-visibility>
<create-form template="../data-lists/forms/dataitem.ftl" />
<appearance>
<field id="orpdl:programName">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
Content model:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="orpdl:orpDataListModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Information retrieved from the Opportunity Registration Process workflow form.</description>
<author>Alan George</author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
<import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl" />
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="http://www.test.com/model/orpDataListModel/1.0" prefix="orpdl" />
</namespaces>
<constraints>
<constraint name="orpdl:contractTypeList" type="LIST">
<parameter name="allowedValues">
<list>
<value>T&M</value>
<value>FFP</value>
<value>CPFF</value>
<value>CPIF</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<type name="orpdl:orpList">
<title>Opportunity Registration Process</title>
<description>Information retrieved from the Opportunity Registration Process workflow form.</description>
<parent>dl:dataListItem</parent>
<properties>
<property name="orpdl:programName">
<title>Program Name</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="orpdl:programDescription">
<title>Program Description</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="orpdl:client">
<title>Client</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="orpdl:contractType">
<title>Contract Type</title>
<type>d:text</type>
<mandatory>true</mandatory>
<constraints>
<constraint ref="orpdl:contractTypeList" />
</constraints>
</property>
<property name="orpdl:value">
<title>Value</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
</type>
</types>
</model>
The goal of this code is to have only the programName text box appear. But this is what I'm seeing:
What am I missing?
You are entering wrong condition in <config> tag.
Below
<config evaluator="model-type" condition="orpdl:orpDataListModel">
should replace with
<config evaluator="model-type" condition="orpdl:issuesList">
This will also apply to node-type.
I have created custom entity employee. Now I want to add listeners for this entity so that I can track add/edit/delete employee operations.
In Liferay for portal enitites like Blogs, Group, User etc we can add properties like
value.object.listener.com.liferay.portal.model.Group=com.smb.test.hook.listeners.GroupListener
in portal.properties via hook-plugin.
But for custom entity this approach does not seem to work.
Any help would be appreciated.
For custom entity, we need to add the listener property in service-ext.properties instead of the portal.properties file.
For my employee entity I have added following property in service-ext.properties file:
value.object.listener.com.smb.employee.model.Employee=com.smb.employee.hook.listeners.EmployeeListener
Note: We need to manually create service-ext.properties file in src folder besides the service.properties file. We could have updated service.properties but since it auto-generates our changes would be lost and hence service-ext.properties is the correct liferay approach.
Here is the location of the service-ext.properties file:
Here is my service.xml:
<service-builder package-path="com.smb.employee">
<author>Suyash</author>
<namespace>smb</namespace>
<entity name="Employee" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="fooId" type="long" primary="true" />
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<!-- Other fields -->
<column name="field1" type="String" />
<column name="field2" type="boolean" />
<column name="field3" type="int" />
<column name="field4" type="Date" />
<column name="field5" type="String" />
<!-- Order -->
<order by="asc">
<order-column name="field1" />
</order>
<!-- Finder methods -->
<finder name="Field2" return-type="Collection">
<finder-column name="field2" />
</finder>
</entity>
</entity>
</service-builder>
I can't seem to use local xsd element in the WSDL schema, since i can't create an external xsd (project conditions).
<types>
<xsd:schema xmlns:fs_req="urn:rg:fs_req" xmlns:sf_facto="urn:rg:sf_facto">
<xsd:import namespace="urn:rg:sf_facto" schemaLocation="ROOT_sf_facto_SF_facto_V00_05.xsd" />
<xsd:import namespace="urn:rg:fs_req" schemaLocation="ROOT_fs_req_fs_req_V00_04.xsd" />
<xsd:element name="getDetailsAction1" type="fs_req:fs_req_fs_req" /
<xsd:element name="getDetailsAction1Response" type="sf_facto:SF_facto_SF_facto"/>
</xsd:schema>
</types>
Below the call of the xsd element (Not valide part!)
<message name="detailMpaResponse">
<part name="getDetail" element="tns:getDetailsAction1Response" />
</message>
<message name="detailMpaRequest">
<part name="getDetailResponse" element="tns:getDetailsAction1" />
</message>
How can i have a valide wsdl with the local xsd element?
The problem looks to be with your namespace qualifier in the <part> nodes.
EDIT:
In looking closer at your original post I think the schema element might hold the values we need. Give this code a shot:
<message name="detailMpaResponse">
<part name="getDetail" element="fs_req:getDetailsAction1Response" />
</message>
<message name="detailMpaRequest">
<part name="getDetailResponse" element="sf_facto:getDetailsAction1" />
</message>
You need to declare a new targetNamespace for the xs:schema in your wsdl:types and add it to wsdl:definitions, something like this:
<types>
<xsd:schema xmlns:types="urn:rg:types" targetNameSpace="urn:rg:types" xmlns:fs_req="urn:rg:fs_req" xmlns:sf_facto="urn:rg:sf_facto">
<xsd:import namespace="urn:rg:sf_facto" schemaLocation="ROOT_sf_facto_SF_facto_V00_05.xsd" />
<xsd:import namespace="urn:rg:fs_req" schemaLocation="ROOT_fs_req_fs_req_V00_04.xsd" />
<xsd:element name="getDetailsAction1" type="fs_req:fs_req_fs_req" />
<xsd:element name="getDetailsAction1Response" type="sf_facto:SF_facto_SF_facto"/>
</xsd:schema>
</types>
then add the new namespace to wsdl:definitions:
xmlns:types="urn:rg:types"
and then refer to it in the message parts:
<message name="detailMpaResponse">
<part name="getDetail" element="types:getDetailsAction1Response" />
</message>
<message name="detailMpaRequest">
<part name="getDetailResponse" element="types:getDetailsAction1" />
</message>
The new namespace can't match the ones you import.
Just did a quick experiment (using Eclipse WSDL editor), and the following code was generated when I selected "using a type" from an external XSD (in the same directory as the WSDL file):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/NewWSDLFile/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="NewWSDLFile"
targetNamespace="http://www.example.org/NewWSDLFile/" xmlns:xsd1="http://www.example.org/NewXMLSchema">
<wsdl:types>
(...)
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.example.org/NewXMLSchema"
schemaLocation="NewXMLSchema.xsd">
</xsd:import>
</xsd:schema>
</wsdl:types>
<wsdl:message name="NewOperationRequest">
<wsdl:part name="parameters" type="xsd1:externalSchemaParamType" />
</wsdl:message>
(...)
In your case: is "tns" the name space of the externa XSD?
My web service operation is defined like below. Where I have a header parameter as well.
public void method(#WebParam(name="OrderNo", mode=WebParam.Mode.IN) String order_no_,
#WebParam(name="user", mode=WebParam.Mode.IN, header=true) String user)
Now when I deploy this service I get a WSDL which looks like this.
<?xml version="1.0" ?>
<wsdl:definitions ... >
<wsdl:types>
</xs:schema>
...
<xs:element name="method" type="tns:method"></xs:element>
<xs:complexType name="method">
<xs:sequence>
<xs:element minOccurs="0" name="OrderNo" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
...
<xs:element name="user" nillable="true" type="xs:string"></xs:element>
...
</xs:schema>
</wsdl:types>
...
<wsdl:message name="method">
<wsdl:part element="tns:method" name="parameters" />
<wsdl:part element="tns:user" name="user" />
</wsdl:message>
...
<wsdl:portType name="CustomerOrderService">
<wsdl:operation name="method">
<wsdl:input message="tns:method" name="method" />
<wsdl:output ... />
<wsdl:fault ... />
</wsdl:operation>
</wsdl:portType>
...
<wsdl:binding name="OrderSoapBinding" type="tns:OrderService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="method">
<soap:operation soapAction="" style="document" />
<wsdl:input name="method">
<soap:header message="tns:method" part="user" use="literal" />
<soap:body parts="parameters" use="literal" />
</wsdl:input>
<wsdl:output name="...">
<soap:body use="literal" />
</wsdl:output>
<wsdl:fault name="...">
...
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
As you can see the header is part of the message used as input for the service request. Hwen I use soap UI to test this WSDL it generated a proper soap message with the "user" property as part of the header.
When I use this service as a partner link in a Carbon BPEL process, and assign a value to the "user" part in the invoke message, the value is not included in the header.
<bpel:variable name="method_Input" messageType="ns0:method" />
<bpel:assign name="...">
...
<bpel:copy>
<bpel:from>$input.payload/tns:TaskReceiver</bpel:from>
<bpel:to>$method_Input.user</bpel:to>
</bpel:copy>
</bpel:assign>
You can see that the message part is assigned the proper value,
The problem is this message part which is bound to the header of of the soap message is never included in the soap header.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<method xmlns="http://customerorder.service.test/">
<OrderNo xmlns="">ORD00011</OrderNo>
</method>
</soapenv:Body>
</soapenv:Envelope>
Thanks in advance to any help provided.
I have a content type defined in Elements.xml and I want to add an Event Receiver. My Elements.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Announcement (0x0104) -->
<ContentType ID="0x0104008a424de98660457481eb7d8ddb5161ee"
Name="News Posting"
Group="News"
Description="$Resources:NewsCTypeDescription"
Inherits="TRUE"
Version="1"
Sealed="TRUE"
>
<FieldRefs>
<FieldRef ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Name="NewsExcerpt"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>ItemAdded</Name>
<Type>ItemAdded</Type>
<Class>MyAssembly.NewsItemEventReceiver</Class>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<SequenceNumber>10000</SequenceNumber>
<Synchronization>Synchronous</Synchronization>
<Data />
<Filter />
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
The weird thing is that the Event Receiver never executes. I've checked the Schema with SharePoint Manager 2010, and it seems that the XmlDocuments element is ignored completely?
Here's the content type SchemaXml according to SharePoint Manager:
<?xml version="1.0" encoding="utf-16"?>
<ContentType ID="0x0104008A424DE98660457481EB7D8DDB5161EE" Name="News Posting" Group="News" Description="A News Posting" Sealed="TRUE" Version="1">
<Folder TargetName="_cts/News Posting" />
<Fields>
<Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentType" Group="_Hidden" Type="Computed" DisplayName="Content Type" Sealed="TRUE" Sortable="FALSE" RenderXMLUsingPattern="TRUE" PITarget="MicrosoftWindowsSharePointServices" PIAttribute="ContentTypeID" Customization="">
<FieldRefs>
<FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId" />
</FieldRefs>
<DisplayPattern>
<MapToContentType>
<Column Name="ContentTypeId" />
</MapToContentType>
</DisplayPattern>
</Field>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" Group="_Hidden" Type="Text" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" Customization="" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
<Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Name="Body" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Body" Group="_Hidden" Type="Note" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" DisplayName="Body" Sortable="FALSE" NumLines="15" Customization="" />
<Field ID="{6a09e75b-8d17-4698-94a8-371eda1af1ac}" Name="Expires" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Expires" Group="_Hidden" Type="DateTime" DisplayName="Expires" Format="DateOnly" Customization="" />
<Field ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Group="News" Name="NewsExcerpt" DisplayName="Excerpt of the Article" Description="165 Characters maximum" MaxLength="165" Type="Text" Customization="" />
</Field>
</Fields>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>
</XmlDocuments>
</ContentType>
I have tried adding a FormTemplates XmlDocument as well, just to see if that works, but even this is ignored (I've changed the ListForm to ListForm2, but the SchemaXml is unchanged.
I've deleted the entire Web Application and Content Database to make sure there was nothing stale/stuck, but the result is still the same.
Is XmlDocuments depreciated in SharePoint 2010? What are the alternatives?
You should add your event receiver as a feature, maybe even as a part of the same feature that installs the content type. We always do it this way and it works perfectly