I try to call VS .Net Web Service on OTRS triger ( e.g. TicketCreate, ArticleCreate ).
1. I've got web function: string newOTRSTest(string TicketID)
2. I've configured Invoker ( TestSimple.pm) for events.
3. In the invoker I've added a key mapping TicketID=>TicketID
But when the invoker it's generated SOAP
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<namesp26:newOTRSTest xmlns:namesp26="http://tempuri.org">
<TicketID>20</TicketID>
</namesp26:newOTRSTest></soap:Body></soap:Envelope>
Calling the function newOTRSTest has marked as namespace but attributs TicketID has without namespace name.
How to make its the same - both with or without namespace addition name?
Run .Net Web Service from OTRS
Re: Run .Net Web Service from OTRS
Ofcourse .Net Web Method couldn't found the parameter value due namespace.
TicketID is null, so the function will not work property at all.
Has anybody any idea for solution?
TicketID is null, so the function will not work property at all.
Has anybody any idea for solution?
-
- Znuny expert
- Posts: 213
- Joined: 04 Nov 2012, 23:58
- Znuny Version: OTRS 4.x
- Real Name: Esteban
- Company: NORTON DE COLOMBIA
Re: Run .Net Web Service from OTRS
Well, you would have to edit the function definition on your .Net Code...and it is a .Net related question .. but i went trhought same problem weeks ago, and here it is, your solution:
In your .net web service, preppend this to your arguments
In your .net web service, preppend this to your arguments
Code: Select all
[XmlElement(Namespace="")]
Re: Run .Net Web Service from OTRS
I try to add empty namespace into web service class definition
Where I should to add this empty XmlElement ?
- public class OTRS : System.Web.Services.WebService
{
[XmlElement(Namespace="")]
.....
- <s11:Body>
<ns1:newOTRSTest xmlns:ns1='http://tempuri.org/'>
<TicketID>3</TicketID>
</ns1:newOTRSTest>
</s11:Body>
Where I should to add this empty XmlElement ?
Re: Run .Net Web Service from OTRS
In the project I've got
using System.Xml.Serialization;
so
XmlElement
means System.Xml.Serialization.XmlElement
using System.Xml.Serialization;
so
XmlElement
means System.Xml.Serialization.XmlElement
-
- Znuny expert
- Posts: 213
- Joined: 04 Nov 2012, 23:58
- Znuny Version: OTRS 4.x
- Real Name: Esteban
- Company: NORTON DE COLOMBIA
Re: Run .Net Web Service from OTRS
You are adding [XmlElement(Namespace="")] in the wrong place. Add it before every argument your webmethod takes.
For example
For example
Code: Select all
..
public .. MethodName([XmlElement(Namespace="")]int TicketID,
[XmlElement(Namespace="")]string SLA){
..
..
}
Re: Run .Net Web Service from OTRS
Thanks for all.
Everything works properly.
Your answer was brilliant.
Everything works properly.
Your answer was brilliant.