How to configure WildFly 8.2 to use AccessLogHandler - jboss

I have found that there is a handler io.undertow.server.handlers.accesslog.AccessLogHandler that can log http access.
However I am not able to configure it so it will produce any log messages.
Here is a code snippet from my standalone.xml:
<filter class-name="io.undertow.server.handlers.accesslog.AccessLogHandler" name="access-log-handler" module="io.undertow.core">
<param name="formatString" value="common"/>
<param name="accessLogReceiver" value="io.undertow.server.handlers.accesslog.JBossLoggingAccessLogReceiver"/>
</filter>
My question is how to configure that handler so it will start producing log messages.

no need to add custom filter for access log. All you need is to configure access log in subsystem itself.
This would be an example:
<host name="default-host" >
<location name="/" handler="welcome-content">
....
<access-log />
</host>
which will by default log in to log folder with prefix access_.log
you can also customize various things, from xsd:
<xs:attribute name="pattern" use="optional" type="xs:string" default="common"/>
<xs:attribute name="worker" use="optional" type="xs:string" default="default"/>
<xs:attribute name="directory" use="optional" type="xs:string" default="${jboss.server.log.dir}"/>
<xs:attribute name="relative-to" use="optional" type="xs:string" />
<xs:attribute name="prefix" use="optional" type="xs:string" default="access_log"/>
<xs:attribute name="suffix" use="optional" type="xs:string" default=".log"/>

I missed to add this xml snippet (StackOverflow):
<host name="default-host" >
.....
<filter-ref name="access-log-handler"/>
</host>
And then I got this:
Caused by: java.lang.NoSuchMethodException: io.undertow.server.handlers.accesslog.AccessLogHandler.<init>(io.undertow.server.HttpHandler)"}}
Which is a known bug: see this, or this
It is possible to use jboss-cli to add a handler and see how the standalone.xml changed:
/subsystem=undertow/configuration=filter/custom-filter=access-log-handler:add(class-name=io.undertow.server.handlers.accesslog.AccessLogHandler, module=io.undertow.core)
/subsystem=undertow/server=default-server/host=default-host/filter-ref=access-log-handler:add

Related

Soap Envelope HTML Payload issue com.ctc.wstx.exc.WstxParsingException: Unexpected '<'

I'm working on the legacy soap API to modify. I have to add an email body in the payload when I'm sending simple text it works fine when I send "<p>test</p>" or HTML it gives me an error.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>com.ctc.wstx.exc.WstxParsingException: Unexpected '<' in attribute value
at [row,col {unknown-source}]: [32,57]</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
my soap API written in ColdFusion 10
XSD
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded">
<xs:complexType mixed = "true">
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="value" use="required" type="xs:string" />
</xs:complexType>
</xs:element>
You want to use encodeForXML (https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-e-g/encodeforxml.html) to escape the content first. If that's not available in CF10, the older XmlFormat (https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-t-z/xmlformat.html).

What is the correct format for SOAP data? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I have a file, I shared it here http://codepad.org/V6FR2Wbs
It seems this file contains SOAP data. But I do not confirm that this contains SOAP data.
So I want to know, is there any specific format for SOAP data.
I got a similar question here What is the correct format of a SOAP response, but I don't see any format related information there.
There is very simple way to validate if request or response SOAPMessage is valid or not.
As a part of SOAP Message, it includes the namespace that points to SOAP XSD aka. XML schema definition, and the message be valid as per that XSD.
In your example, the SOAP message is--
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"> <SOAP-ENV:Header> <cwmp:ID SOAP-ENV:mustUnderstand="1">279384</cwmp:ID> </SOAP-ENV:Header> <SOAP-ENV:Body> <cwmp:Inform> <DeviceId> <Manufacturer>Huawei Technologies Co., Ltd</Manufacturer> <OUI>00259E</OUI> <ProductClass>EG8040H5</ProductClass> <SerialNumber>48575443FF5E5D9D</SerialNumber> </DeviceId> <Event SOAP-ENC:arrayType="cwmp:EventStruct[1]"> <EventStruct> <EventCode>2 PERIODIC</EventCode> <CommandKey/> </EventStruct> </Event> <MaxEnvelopes>1</MaxEnvelopes> <CurrentTime>2019-06-19T15:30:33+00:00</CurrentTime> <RetryCount>0</RetryCount> <ParameterList SOAP-ENC:arrayType="cwmp:ParameterValueStruct[8]"> <ParameterValueStruct> <Name>InternetGatewayDevice.ManagementServer.ParameterKey</Name> <Value xsi:type="xsd:string"/> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.ManagementServer.ConnectionRequestURL</Name> <Value xsi:type="xsd:string">http://10.240.12.35:7547/1d9564b694ef18090a9377cd6f3217eb</Value> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.DeviceSummary</Name> <Value xsi:type="xsd:string">InternetGatewayDevice:1.4[](Baseline:1, EthernetLAN:1, WiFiLAN:2, Time:1, IPPing:1, DeviceAssociation:1)</Value> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.DeviceInfo.SpecVersion</Name> <Value xsi:type="xsd:string">1.0</Value> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.DeviceInfo.HardwareVersion</Name> <Value xsi:type="xsd:string">172D.A</Value> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.DeviceInfo.SoftwareVersion</Name> <Value xsi:type="xsd:string">V5R019C00S115</Value> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.DeviceInfo.ProvisioningCode</Name> <Value xsi:type="xsd:string"/> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress</Name> <Value xsi:type="xsd:string">10.240.12.35</Value> </ParameterValueStruct> </ParameterList> </cwmp:Inform> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
In your example SOAP schema is located as http://schemas.xmlsoap.org/soap/envelope/
And the XSD for that schema is--
<?xml version='1.0' encoding='UTF-8' ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/"
targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" >
<!-- Envelope, header and body -->
<xs:element name="Envelope" type="tns:Envelope" />
<xs:complexType name="Envelope" >
<xs:sequence>
<xs:element ref="tns:Header" minOccurs="0" />
<xs:element ref="tns:Body" minOccurs="1" />
<xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:element name="Header" type="tns:Header" />
<xs:complexType name="Header" >
<xs:sequence>
<xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:element name="Body" type="tns:Body" />
<xs:complexType name="Body" >
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax" >
<xs:annotation>
<xs:documentation>
Prose in the spec does not specify that attributes are allowed on the Body element
</xs:documentation>
</xs:annotation>
</xs:anyAttribute>
</xs:complexType>
<!-- Global Attributes. The following attributes are intended to be usable via qualified attribute names on any complex type referencing them. -->
<xs:attribute name="mustUnderstand" >
<xs:simpleType>
<xs:restriction base='xs:boolean'>
<xs:pattern value='0|1' />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="actor" type="xs:anyURI" />
<xs:simpleType name="encodingStyle" >
<xs:annotation>
<xs:documentation>
'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification
</xs:documentation>
</xs:annotation>
<xs:list itemType="xs:anyURI" />
</xs:simpleType>
<xs:attribute name="encodingStyle" type="tns:encodingStyle" />
<xs:attributeGroup name="encodingStyle" >
<xs:attribute ref="tns:encodingStyle" />
</xs:attributeGroup>
<xs:element name="Fault" type="tns:Fault" />
<xs:complexType name="Fault" final="extension" >
<xs:annotation>
<xs:documentation>
Fault reporting structure
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="faultcode" type="xs:QName" />
<xs:element name="faultstring" type="xs:string" />
<xs:element name="faultactor" type="xs:anyURI" minOccurs="0" />
<xs:element name="detail" type="tns:detail" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="detail">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax" />
</xs:complexType>
</xs:schema>
Using any programming language or API or online service, you could validate the SOAP message against the given XSD manually or automated way.
E.g.
As I did using this online service(https://www.liquid-technologies.com/online-xsd-validator) and your SOAP message found valid against the schema.

XML to CSV with data header using Liquid Data Mapper

I have an XML file that describes a header and a list. I need to generate a CSV file where the first line of the file is constructed from the header information and the subsequent lines of the file constructed from the list. The header has a different number of columns to the list items.
This is easy to do with xsl. How can I do it with the data mapper using the .NET mapping engine?
A simple example to explain. XSD of input xml
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="A" />
<xs:element name="B" />
<xs:element name="Line" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="C" />
<xs:element name="D" />
<xs:element name="E" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
An Example Input XML
<Root>
<A>Header Value</A>
<B>112233</B>
<Line>
<C>22</C>
<D>Fred</D>
<E>1</E>
</Line>
<Line>
<C>34</C>
<D>Jim</D>
<E>2</E>
</Line>
<Line>
<C>42</C>
<D>Amanda</D>
<E>1</E>
</Line>
<Line>
<C>1267</C>
<D>Vickie</D>
<E>2</E>
</Line>
</Root>
Required Text Output:
Header Value|112233
22|Fred|1
34|Jim|2
42|Amanda|1
1267|Vickie|2
Generating either
Header Value|112233
or
22|Fred|1
34|Jim|2
42|Amanda|1
1267|Vickie|2
as individual csv files is easy (as it should be) but how can I can't see how to produce the required file other than resorting back to xslt.
You can set up a transform that looks something like this if you want to be able to dynamically set the headers.
You double up the 'Row' inputs using the 'Duplicate' option
Before you do that you need to tweak your schema. The input values A-E need typing (note the type="xs:string").
<?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid Studio 2019 (https://www.liquid-technologies.com)-->
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="A" type="xs:string" />
<xs:element name="B" type="xs:string" />
<xs:element name="Line" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="C" type="xs:string" />
<xs:element name="D" type="xs:string" />
<xs:element name="E" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
This will give you output data that looks like this (note it always outputs 3 columns, so you get a trailing '|').
Header Value|112233|
22|Fred|1
34|Jim|2
42|Amanda|1
1267|Vickie|2
If you just want the data and no header then you can just connect it up like this

How can I fix configuration errors in ext.net?

I'm new at ext.net. I create a new project and I change the web.config code but i always take configuration error. What am I supposed to do to fix this? here is my web.config code.
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false"/>
</configSections>
<extnet scriptMode="Release"/>
<!-- See Property Options in README.txt -->
<!--
The following system.web section is only requited for running ASP.NET AJAX under Internet
Information Services 6.0 (or earlier). This section is not necessary for IIS 7.0 or later.
-->
<system.web>
<httpHandlers>
<add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false"/>
</httpHandlers>
<httpModules>
<add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net"/>
</httpModules>
<compilation debug="true">
<assemblies>
<add assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies></compilation></system.web>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0.
It is not necessary for previous version of IIS.
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="DirectRequestModule" preCondition="managedHandler" type="Ext.Net.DirectRequestModule, Ext.Net"/>
</modules>
<handlers>
<add name="DirectRequestHandler" verb="*" path="*/ext.axd" preCondition="integratedMode" type="Ext.Net.ResourceHandler"/>
</handlers>
</system.webServer>
A sample Web.config for Ext.NET is located in the Examples Explorer.
Add </ configuration> at end of file
You can add a Schema to Visual Studio. I made a schema that you can add manually.
http://forums.ext.net/showthread.php?27683-XML-Extnet-Schema-to-avoid-Information-Error-in-web-config
Add this code before tag into DotNetConfig.xsd schema.
I create the element based on 2.4.0 README File. http://examples.ext.net/#/Getting_St...uments/README/
<?xml version="1.0" encoding="us-ascii"?>
<xs:element name="extnet" vs:help="configuration/extnet">
<xs:complexType>
<xs:attribute name="ajaxViewStateMode" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Default" />
<xs:enumeration value="Exclude" />
<xs:enumeration value="Include" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="cleanResourceUrl" type="small_boolean_Type" use="optional" />
<xs:attribute name="dateTimeZoneHandling" type="xs:string" use="optional" />
<xs:attribute name="disableViewState" type="small_boolean_Type" use="optional" />
<xs:attribute name="directEventUrl" type="xs:string" use="optional" />
<xs:attribute name="directMethodProxy" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Default" />
<xs:enumeration value="Include" />
<xs:enumeration value="Ignore" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="directMethodNamespace" type="xs:string" use="optional" />
<xs:attribute name="glyphFontFamily" type="xs:string" use="optional" />
<xs:attribute name="gzip" type="small_boolean_Type" use="optional" />
<xs:attribute name="idMode" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Client" />
<xs:enumeration value="Explicit" />
<xs:enumeration value="Ignore" />
<xs:enumeration value="Inherit" />
<xs:enumeration value="Legacy" />
<xs:enumeration value="Parent" />
<xs:enumeration value="Predictable" />
<xs:enumeration value="Static" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="initScriptMode" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Inline" />
<xs:enumeration value="Linked" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="licenseKey" type="xs:string" use="optional" />
<xs:attribute name="locale" type="xs:string" use="optional" />
<xs:attribute name="namespace" type="xs:string" use="optional" />
<xs:attribute name="renderScripts" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Embedded" />
<xs:enumeration value="File" />
<xs:enumeration value="CDN" />
<xs:enumeration value="None" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="renderStyles" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Embedded" />
<xs:enumeration value="File" />
<xs:enumeration value="CDN" />
<xs:enumeration value="None" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="resourcePath" type="xs:string" use="optional" />
<xs:attribute name="resourcesStrategyType" type="xs:string" use="optional" />
<xs:attribute name="resetStyles" type="small_boolean_Type" use="optional" />
<xs:attribute name="rethrowAjaxExceptions" type="small_boolean_Type" use="optional" />
<xs:attribute name="rtl" type="small_boolean_Type" use="optional" />
<xs:attribute name="scriptMode" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Release" />
<xs:enumeration value="Debug" />
<xs:enumeration value="Development" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="showWarningOnAjaxFailure" type="small_boolean_Type" use="optional" />
<xs:attribute name="sourceFormatting" type="small_boolean_Type" use="optional" />
<xs:attribute name="stateProvider" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="PostBack" />
<xs:enumeration value="Cookie" />
<xs:enumeration value="None" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="submitDisabled" type="small_boolean_Type" use="optional" />
<xs:attribute name="theme" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Default" />
<xs:enumeration value="Access" />
<xs:enumeration value="Gray" />
<xs:enumeration value="Neptune" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="themePath" type="xs:string" use="optional" />
<xs:attribute name="quickTips" type="small_boolean_Type" use="optional" />
<xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/>
</xs:complexType>
</xs:element>
Then you can debug what is wrong on your ext.net configuration. And additionally you can use and have Ext.net Intellisense on web.config :D

samlp:RequestAbstractType - Trying to understand the ExtensionsType

According to SAML 2.0, a RequestAbstractType is defined in the following way:
<complexType name="RequestAbstractType" abstract="true">
<sequence>
<element ref="saml:Issuer" minOccurs="0"/>
<element ref="ds:Signature" minOccurs="0"/>
<element ref="samlp:Extensions" minOccurs="0"/>
</sequence>
<attribute name="ID" type="ID" use="required"/>
<attribute name="Version" type="string" use="required"/>
<attribute name="IssueInstant" type="dateTime" use="required"/>
<attribute name="Destination" type="anyURI" use="optional"/>
<attribute name="Consent" type="anyURI" use="optional"/>
</complexType>
What I'm interested in is the Extensions element, which is defined as:
<element name="Extensions" type="samlp:ExtensionsType"/>
<complexType name="ExtensionsType">
<sequence>
<any namespace="##other" processContents="lax" maxOccurs="unbounded"/>
</sequence>
</complexType>
How would I add/implement such an extension? I have no clue how to extend the RequestAbstractType.
The element allows you to include anything you want within it. Adding and processing of any data within that element would depend on your SAML product.
To give you an example of how it's used, here's a spec that leveraged it: http://docs.oasis-open.org/security/saml/SpecDrafts-Post2.0/sstc-saml-protocol-ext-rac.pdf