I am trying to write a script that will talk to the Autotask API and I'm using the Script Console to test on.
When I run I am hitting this error:
javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLInputFactory cannot be created
and I've tried adding that as an import but it still fails.
Based on some posts online I believe the issue is something to do with the Autotask API messages needing to be in XML but not sure how to get around this.
I'm just doing a very simple call right now to verify the connection will work.
Here is the test code I've written, this is taken from some sample code I was given and also from their documentation:
import javax.xml.ws.BindingProvider
import net.autotask.atws.v1_5.ATWS
import net.autotask.atws.v1_5.ATWSResponse
import net.autotask.atws.v1_5.ATWSSoap
import net.autotask.atws.v1_5.ATWSZoneInfo
import net.autotask.atws.v1_5.GetZoneInfo
import net.autotask.atws.v1_5.Ticket
import net.autotask.atws.v1_5.ArrayOfEntity
import net.autotask.atws.v1_5.Entity
import groovyx.net.http.HTTPBuilder
def ATWS newser = new ATWS()
ATWSSoap port = newser.getPort(ATWSSoap.class)
BindingProvider prov = (BindingProvider) port
prov.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,"username")
prov.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "userspwd")
prov.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"https://webservices2.autotask.net/ATServices/1.5/atws.asmx")
def ATWSZoneInfo azi = new ATWSZoneInfo()
azi = port.getZoneInfo("username")
return azi.URL