Create html ticket with generic interface

Moderator: crythias

Locked
nicolasp
Znuny newbie
Posts: 2
Joined: 08 Jul 2013, 09:18
Znuny Version: 3.2.8

Create html ticket with generic interface

Post by nicolasp »

Hello OTRS community,

I'm using the generic interface (under OTRS 3.2.8 ) to create a new ticket and article. It's working perfectly for text/plain body content, but I would like to create html-based article, like it is done when you create a new mail ticket.

If I set

Code: Select all

<ContentType>text/html; charset=utf8</ContentType>
and give a html content (with replacement of the '<' and '>' by '<'... or not) I always get an error 500 from the server.
The html content I give is the full html page like

Code: Select all

<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head>
<body style="font-family:Geneva,Helvetica,Arial,sans-serif; font-size: 12px;">
	<span style="color:#FF8C00;">Texte html</span><br />
	<b>test from WS</b>
</body></html>
I noticed that html article are stored in the attachement directory for the article, under the name 'file-2' (and also with the file-2.content-type and plain.txt which is is multi-part message) that is loaded to display the article.

So if I put a file named 'file-2' here, it could work, but I'm not happy with that.

Is there anything I do wrong? Or anyone has already created html tickets from the webservices ?

Thanks for your help
nicolasp
Znuny newbie
Posts: 2
Joined: 08 Jul 2013, 09:18
Znuny Version: 3.2.8

Re: Create html ticket with generic interface

Post by nicolasp »

Some additional information from the WS debugger :

In the "Received data by provider from remote system" I have my input message :

Code: Select all

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><TicketCreate xmlns="http://www.otrs.org/TicketConnector/">
<UserLogin>*****</UserLogin>
<Password>*****</Password>
<Ticket>
    <Title>some title</Title>
    <CustomerUser>test</CustomerUser>
    <Queue>Junk</Queue>
    <State>new</State>
    <PriorityID>3</PriorityID>
</Ticket>
<Article>
    <Subject>some subject</Subject>
    <Body><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head>
<body style="font-family:Geneva,Helvetica,Arial,sans-serif; font-size: 12px;">
	<span style="color:#FF8C00;">Texte html</span><br />
	<b>test from WS</b>
</body></html></Body>
    <ContentType>text/html; charset=utf8</ContentType>
</Article>
<DynamicField>
	<Name>TypeDemande</Name>
	<!--1 or more repetitions:-->
	<Value>REX</Value>
 </DynamicField>
</TicketCreate></soap:Body></soap:Envelope>
The '<' and '>' characters were html-coded before, but appear decoded here.

Then I have "Request could not be processed"

Code: Select all

Error deserializing message:
not well-formed (invalid token) at line 17, column 25, byte 1009 at /usr/lib/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser.pm line 187
Looks like the <Body> tag does not accept any other inner tag...

EDIT : it works... just a bad encoded closing tag... the parser was right !
Locked