Shorten WSDL syntax by using defaults - soap

I am a newbie in WSDL syntax so I am just using it in a very basic way, e.g.
<message name="ping_Request">
</message>
<message name="ping_Response">
<part name="response" type="xsd:string" />
</message>
<message name="auth_Request">
<part name="username" type="xsd:string" />
<part name="password" type="xsd:string" />
</message>
<message name="auth_Response">
<part name="response" type="xsd:string" />
</message>
<portType name="ping_PortType">
<operation name="ping">
<input message="tns:ping_Request" />
<output message="tns:ping_Response" />
</operation>
</portType>
<portType name="auth_PortType">
<operation name="auth">
<input message="tns:auth_Request" />
<output message="tns:auth_Response" />
</operation>
</portType>
<binding name="auth_Binding" type="tns:auth_PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="auth">
<soap:operation soapAction="auth"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:auth_NameSpace"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:auth_NameSpace"/>
</output>
</operation>
</binding>
<service name="info_Service">
<port binding="tns:ping_Binding" name="ping_Port">
<soap:address location="https://service.example.com/info/info.php"/>
</port>
<port binding="tns:auth_Binding" name="auth_Port">
<soap:address location="https://service.example.com/info/info.php"/>
</port>
</service>
I found my self copying and pasting these blocks for any new function, modifying only the relevant keywords, so I end up with quite a long WSDL even for a relatively small number of functions.
By using WSDL defaults, is it possible to shorten this syntax to a minimum, by removing unnecessary or repeated parameters?
NOTE: this WSDL has to be read by a VB6 soap client library, which has very limited features.

Related

Stop log4net (or services) using a file when errors are not being placed in it

I have the following log4net config
<?xml version="1.0" encoding="utf-8" ?>
<log4net xmlns="urn:log4net">
<appender name ="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="C:\temp\Generator.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maximumFileSize value="500KB" />
<maxSizeRollBackups value="10" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{DATE} %level %thread %logger - %message%newline" />
</layout>
</appender>
<appender name ="GenerationErrors" type="log4net.Appender.FileAppender">
<file type="log4net.Util.PatternString" value="c:\temp\GenerationErrors.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{DATE} %level %thread %logger - %message%newline" />
</layout>
</appender>
<root>
<appender-ref ref="RollingFile" />
<level value="INFO" />
</root>
<logger name ="GPA.Module.Generate">
<level value="INFO" />
<appender-ref ref="GenerationErrors" />
</logger>
<logger name="PmuManagement">
<level value="INFO" />
<appender-ref ref="GenerationErrors" />
</logger>
</log4net>
The first appender logs all errors for all of my processes and the second only logs a certain group of errors, as required.
I need to be able to delete the contents of the second log file on the fly however this isn't currently possible as the programme needs constant access to it to run (if you try and make any changes you get the "this file is in use by another programme" error.
Is there a way for log4net to only need access to the file when errors need to be written to it?
Or is there a more generic way to stop services/programmes needing access to file temporarily and allowing access again shortly after?
Thanks
I found this question here Intermittent log4net RollingFileAppender locked file issue and the answer is what I needed. I simply added <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> to my second appender.

Failed importing: Attribute "name" was already specified for element "option"

<joblist>
<job>
<context>
<options preserveOrder='true'>
<option name='PDATE' value='${DATE:yyyyMMdd}' />
<option name='TSTAMP' value='${DATE:yyyy-MM-dd&apos;T&apos;HH.mm.ssXX}' />
</options>
</context>
<description>Load Adjustment Transactions</description>
<dispatch>
<excludePrecedence>true</excludePrecedence>
<keepgoing>false</keepgoing>
<rankOrder>ascending</rankOrder>
<successOnEmptyNodeFilter>false</successOnEmptyNodeFilter>
<threadcount>1</threadcount>
</dispatch>
<executionEnabled>true</executionEnabled>
<group>PointsUpdate</group>
<id>6475eb91-926f-476b-bf05-85f5e8b22eae</id>
<loglevel>INFO</loglevel>
<name>sglp-jbadjust</name>
<nodeFilterEditable>true</nodeFilterEditable>
<nodefilters>
<filter>.*</filter>
</nodefilters>
<nodesSelectedByDefault>true</nodesSelectedByDefault>
<schedule>
<dayofmonth />
<month day='*' month='*' />
<time hour='00' minute='00' seconds='00' />
<year year='*' />
</schedule>
<scheduleEnabled>false</scheduleEnabled>
<sequence keepgoing='false' strategy='sequential'>
<command>
<exec>echo one ${option.PDATE} two ${option.TSTAMP} three</exec>
</command>
</sequence>
</job>
</joblist>
git-import importing this gives me errors, but I do not know why:
Failed importing: rundeck/jobs/PointsUpdate_0014.xml: rundeck.controllers.JobXMLException: Unable to parse xml: org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 110; Attribute "name" was already specified for element "option".
Importing into the Rundeck GUI works fine, no errors reported, and options are correct.
I just imported your job and also tested using Tomcat 9 + Rundeck 2.4.3 + Linux. I'm not able to reproduce this error. May you provide additional data about Rundeck version,installation method,OS?
Importing using GIT
Importing using GUI

Office Addin Manifest With a Ribbon Button for Office 2013

I have built a Word addin manifest that inserts a button in the Home tab. Button opens a taskpane, addin does not use commands, therefore is suitable not only for Office 2016, but for Office 2013 as well.
Even though the addin works fine on both Office versions, the button is inserted into the Home tab on Office 2016, but not on 2013.
I suspect there may be something else expected in the manifest, even though I read that VersionOverrides node is sufficient to support both versions.
This is the manifest that shows no problem in Word 2016:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfficeApp
xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides"
xsi:type="TaskPaneApp">
<Id>05c2e1c9-3e1d-406e-9a91-e9ac64854143</Id>
<Version>1.0.0.0</Version>
<ProviderName>DEMO</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Name">
<Override Locale="en-US" Value="Name" />
</DisplayName>
<Description DefaultValue="Addin" >
<Override Locale="en-US" Value="Addin" />
</Description>
<IconUrl DefaultValue="https://localhost:3000/assets/logo-32.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/logo-80.png"/>
<SupportUrl DefaultValue="support.com" />
<AppDomains>
<AppDomain>localhost</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Document"/>
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="https://localhost:3000/taskpane.html"/>
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
<ov:VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<ov:Hosts>
<ov:Host xsi:type="Document">
<ov:DesktopFormFactor>
<ov:GetStarted>
<ov:Title resid="GetStarted.Title"/>
<ov:Description resid="GetStarted.Description"/>
<ov:LearnMoreUrl resid="GetStarted.LearnMoreUrl"/>
</ov:GetStarted>
<ov:ExtensionPoint xsi:type="PrimaryCommandSurface">
<ov:OfficeTab id="TabHome">
<ov:Group id="AddinGroup">
<ov:Label resid="CommandsGroup.Label" />
<ov:Icon>
<bt:Image size="16" resid="Icon.16x16" />
<bt:Image size="32" resid="Icon.32x32" />
<bt:Image size="80" resid="Icon.80x80" />
</ov:Icon>
<ov:Control xsi:type="Button" id="AddinButton">
<ov:Label resid="AddinButton.Label" />
<ov:Supertip>
<ov:Title resid="AddinButton.Label" />
<ov:Description resid="AddinButton.Tooltip" />
</ov:Supertip>
<ov:Icon>
<bt:Image size="16" resid="Icon.16x16" />
<bt:Image size="32" resid="Icon.32x32" />
<bt:Image size="80" resid="Icon.80x80" />
</ov:Icon>
<ov:Action xsi:type="ShowTaskpane">
<ov:TaskpaneId>AddinButtonTaskpane</ov:TaskpaneId>
<ov:SourceLocation resid="AddinTaskpane.Url" />
</ov:Action>
</ov:Control>
</ov:Group>
</ov:OfficeTab>
</ov:ExtensionPoint>
</ov:DesktopFormFactor>
</ov:Host>
</ov:Hosts>
<ov:Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/logo-16.png"/>
<bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/logo-32.png"/>
<bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/logo-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="GetStarted.LearnMoreUrl" DefaultValue="http://started.com" />
<bt:Url id="AddinTaskpane.Url" DefaultValue="https://localhost:3000/taskpane.html" />
</bt:Urls>
<bt:ShortStrings>
<bt:String id="GetStarted.Title" DefaultValue="GetStarted" >
</bt:String>
<bt:String id="CommandsGroup.Label" DefaultValue="Addin" >
</bt:String>
<bt:String id="AddinButton.Label" DefaultValue="Addin" >
</bt:String>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="GetStarted.Description" DefaultValue="GetStarted" >
</bt:String>
<bt:String id="AddinButton.Tooltip" DefaultValue="Addin" >
</bt:String>
</bt:LongStrings>
</ov:Resources>
</ov:VersionOverrides>
</OfficeApp>
Add-in commands are not supported on Word 2013. For more information on supported platforms for add-in commands see here

CXF wadl2java generate code from grammar

The code generation with for the methods works fine, but it seems to me that the grammar part is omitted because no Pojo and JAXB annotations are generated. Do I have to specify some additional configuration? I used this command: wadl2java.bat -p packagename /path/to/wadl
Here is a snippet of the wadl.
<application
xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.tns.de">
<grammer>
<xsd:include href="file1.xsd"></xsd:include>
<xsd:include href="file2.xsd"></xsd:include>
<xsd:include href="file3.xsd"></xsd:include>
<xsd:include href="file14.xsd"></xsd:include>
</grammer>
<resources base="http:localhost:8080/rest">
<resource path="status/{id}" id="statusId">
<param name="id" type="xsd:unsignedInt" required="true" default="" style="template"/>
<method name="GET" id="getById">
<request>
<representation mediaType="application/json" element="tns:type1"/>
</request>
<response>
<representation mediaType="application/json" element="tns:type2"/>
</response>
</method>
....
I found my mistake. There was a typo in the wadl. Previously I used <grammer> but you have to use <grammars>
Now it works.
<application
xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.tns.de">
<grammars>
<include href="file1.xsd"></xsd:include>
<include href="file2.xsd"></xsd:include>
<include href="file3.xsd"></xsd:include>
<include href="file14.xsd"></xsd:include>
</grammars>
<resources base="http:localhost:8080/rest">
<resource path="status/{id}" id="statusId">
<param name="id" type="xsd:unsignedInt" required="true" default="" style="template"/>
<method name="GET" id="getById">
<request>
<representation mediaType="application/json" element="tns:type1"/>
</request>
<response>
<representation mediaType="application/json" element="tns:type2"/>
</response>
</method>

Formatting XML files in eclipse

When i try to format a xml file in eclipse it puts each of the fields on a new line. instead i want each property to be on one line. for e.g. now when i press CTRL+SHFT+F, eclipse formats it like this.
<hibernate-mapping package="com.server.entities">
<class
name="Branch"
table="Branch"
>
<meta attribute="sync-DAO">false</meta>
<id name="Id"
type="java.lang.Long"
column="id"
>
<generator class="native"/>
</id>
<property
name="Created"
column="created"
type="timestamp"
not-null="false"
length="23"
/>
<property
name="LastUpdated"
column="lastUpdated"
type="timestamp"
not-null="false"
length="23"
/>
<property
name="CreatedBy"
column="createdBy"
type="java.lang.Long"
not-null="false"
length="19"
/>
but what i want is
<hibernate-mapping package="com.kaizen.report.server.entities">
<class name="Branch" table="Branch">
<meta attribute="sync-DAO">false</meta>
<id name="Id" type="java.lang.Long" column="id">
<generator class="native"/>
</id>
<property name="Created" column="created" type="timestamp" not-null="false" length="23"/>
If you're using the XML Editor from eclipse.org, go tot he XML Editor preference page and change the options to allow much longer lines and to not split multiple attributes each onto new lines.