Hi,
We have a requirement to integrate JIRA with external application (this is NOT JIRA application).
External application has SOAP webservice. I need to call this webservice from JIRA on transition post function.
How do we achieve this? Is webhooks can be used for SOAP? Can we use Script Runner? If Yes, example code would be helpful.
Thanks in advance.
JIRA doesn't support SOAP anymore starting from version 7.x.
You should resort to using REST.
If you want to inform your web app regarding issue related even, then you can use Webhooks. (shortcut: g+g --> Webhooks)
Depending on your needs, you can write JIRA listeners and make REST calls from the listener as well.
If you want to make to make Rest calls from your web app to JIRA.
Look for Application Links in your JIRA (shortcut: g+g --> Application Links)
You can link application there, even authenticate it using OAuth and make rest calls on JIRA.
Jira doesn't have incoming SOAP calls any more, but that does not stop you configuring or writing code for outgoing SOAP calls to other applications that do use it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the reply.One of our JIRA instance still at 6.4.10 and soon planning to upgrade to latest JIRA version.
I am having trouble in creating webhook in JIRA 6.4.10 version, i am keep on getting "Selected WebHook has already been deleted. Please reload the page." error. Our JIRA instance does not have any webhooks and i am not sure why it is complaining.
webhooks in enabled and no errors in the logs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I noticed following error in logs when restarting JIRA:
2017-10-28 20:10:29,040 localhost-startStop-1 ERROR [sal.core.upgrade.PluginUpgrader] Upgrade failed: bundle [com.atlassian.jira.plugins.webhooks.jira-webhooks-plugin]
com.atlassian.activeobjects.internal.ActiveObjectsInitException: bundle [com.atlassian.jira.plugins.webhooks.jira-webhooks-plugin]
2017-10-28 20:11:29,470 localhost-startStop-1 ERROR [atlassian.event.internal.AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.jira.event.property.StringApplicationPropertySetEvent@7e9a733d] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.webhooks.plugin.WebHookEventsProcessor.onEvent(java.lang.Object), listener=com.atlassian.webhooks.plugin.WebHookEventsProcessor@e4725cd}]
java.lang.RuntimeException: bundle [com.atlassian.jira.plugins.webhooks.jira-webhooks-plugin]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, i have the same problem, i have to call a SOAP Webservice from Jira (because our IBM-HOST only supports COBOL SOAP Webservices).
The easiest way ( for me) ist to implement a scriptrunner module. I found an example code with groovyx.net.ws.WSClient but this library is not part of the basic scriptrunner environment ("unable to resolve class groovyx.net.ws.WSClient").
How can i get a JAR File of this library (groovyx.net.ws.WSClient) ?
I found a github adress groovy-ws/src/main/java/groovyx/net/ws/WSClient.java at master · jboyens/groovy-ws · GitHub
but there is no download of a JAR-File.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried to use the various soap libraries, but I was never satisfied with them.
In the end, I've ended up just using groovyx.net.http.HTTPBuilder and the soap envelope and body using plain XML markupbuilder.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Peter-Dave Sheehan Thank you very much for your fast answer. Where can i find a groovy SampleCode for a SOAP Request with this HTTPBuilder ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A lot will depend on what's required by your end point...
But here is a sample that was used to generate a session on a system that requires login:
import groovy.xml.MarkupBuilder
import groovy.xml.XmlUtil
import groovy.xml.slurpersupport.NodeChild
import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.HttpResponseDecorator
import groovyx.net.http.Method
def xmlWriter = new StringWriter()
def xml = new MarkupBuilder(xmlWriter)
def username = "myusername"
def password = "mypassword"
def soapServiceBaseUrl = "https://example.com"
def soapServicePath = "/WebService/WSLogin.asmx"
def userId, workgroupId,userToken //values that will be populated from the soap response
xml.mkp.xmlDeclaration(version: "1.0", encoding: 'utf-8')
xml.'soap:Envelope'(
'xmlns:soap': 'http://schemas.xmlsoap.org/soap/envelope/',
'xmlns:wsl': 'http://changepoint.com/changepoint/CPWebService/WSLogin'
) {
'soap:Header' {
'wsse:Security'(
'mustUnderstand': true,
'xmlns:wsse': 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd',
'xmlns:wsu': 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'
) {
'wsse:UsernameToken'('wsu:Id': "LOGIN-${UUID.randomUUID()}") {
'wsse:Username'(username)
'wsse:Password'('Type': 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText', password)
'wsse:Nonce'(
'EncodingType': 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary',
UUID.randomUUID().toString().bytes.encodeBase64().toString()
)
'wsu:Created'(new Date().toInstant())
}
}
}
'soap:Body' {
'wsl:Login' {
'wsl:userLoginId'(username)
}
}
}
def client = new HTTPBuilder(soapServiceBaseUrl)
log.debug "Connecting to $soapServiceBaseUrl$soapServicePath using HTTPBuilder client and sending xml to get login token"
client.request(Method.POST, ContentType.XML) {
uri.path = '/CPWebService/WSLogin.asmx'
headers.SoapAction = Constants.CP_ACTION_LOGIN
body = xmlWriter.toString()
response.success = { HttpResponseDecorator httpResponse, NodeChild xmlData ->
log.debug "SOAPClient respsonse body: \n${XmlUtil.serialize(xmlData)}"
userId = xmlData.Body.LoginResponse.LoginResult.value.UserId
workgroupId = xmlData.Body.LoginResponse.LoginResult.value.WorkgroupId
userToken = xmlData.Body.LoginResponse.LoginResult.value.AccessToken
}
response.failure = { httpResponse, xmlData ->
log.error "Bad response from SoapService: ${XmlUtil.serialize(xmlData)}"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @PD Sheehan
I have a similar requirement to send a POST request using SOAP API. Below is the code that I have written, but I am sure that it is not the correct way of defining the XML body.
Also, the response would also be an XML body. It would be great if you can correct my code.
import groovyx.net.http.ContentType
import groovyx.net.http.HttpResponseDecorator
import groovyx.net.http.RESTClient
def url = 'https://testing.gorillas.app.net'
def body = '''
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CreateUserSessionFromInstance xmlns="http://archer-tech.com/webservices/">
<userName>OneAPI_Jira</userName>
<instanceName>SYS_INT</instanceName>
<password>CmQP58NHZ4BGrB8ex!+</password>
</CreateUserSessionFromInstance>
</soap:Body>
</soap:Envelope>
'''
def postResponse = post(url, "/edgemicro_agp/ws/general.asmx", "", body)
return postResponse
def post(def hostUrl, def endpoint, def query, def bodyJson) {
def client = new RESTClient(hostUrl)
client.setHeaders([
'Accept' : ContentType.ANY,
'x-api-key': '1364b72c-6c20-4a19-a4f6-413994584',
'Content-Type': 'text/xml; charset=utf-8',
'SOAPAction' : 'http://system-tech.com/webservices/CreateUserSessionFromInstance'
])
client.handler.success = { HttpResponseDecorator response, xml ->
xml
}
client.handler.failure = { HttpResponseDecorator response ->
// Failure can be handled here
log.error "POST Error: $response.statusLine"
}
client.post(
path: endpoint,
//queryString: query,
contentType: ContentType.XML,
body: bodyJson
)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you specify ContentType.XML in your POST, HTTPBuilder should automatically parse the XML body groovy.xml.XmlSlurper.
At first glance you code seems fine.
What needs correcting?
The only possible issue I see is that I don't think you need to manually set the Conte-Type header. Using the setting contentType in the post method should default the header.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @PD Sheehan
I actually got it to work now! I just removed all the new lines in the XML data defined in the body variable and it worked. 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist-What do you think is the best way to implement a custom code for outgoing request in SOAP and the second question, How to control if the other server (not jira) does not respond, how to control the reintent? is there a way to use queue in services soap?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's been a long long time since I write any code for access things over SOAP.
I would still take the same general approach - write code that pokes the remote server, waits for a response and then parses the results to check for errors. If there's a failure or timeout, record it or fail gracefully (For example, if you're in a listener or post function, write a "process failed" comment or field. If you're in a validator or condition, return an error, so that the "result" is a failure)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist-@Tayyab Bashiryour answers are so very very bad , try to be helpful or don't' reply
damage there is no dislike option
@Srilatha Pokalathanks for this question , could you share with me any solution?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm. We gave accurate and helpful answers within the scope of the question.
Not sure what is so "bad" about that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am sure you are better than me in english, so could you readf and explain else.
He asked about "invoking in Jira, soap webservices of an other external application which is not JIRA ". which is possible.
and you replied with it's not possible, jira does not support soap webservices. Yes jira does not expose soap webservices , but Jira can consume soap webservices of external applications
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is what I said, so I'm not sure if you were misreading or misunderstanding what I wrote.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.