jwagenleitner
2012-12-04 16:38:06 UTC
In your closure, instead of using `text` try using `urlenc` instead.
... {
type: ContentType.URLENC
urlenc cs:'12345,23456,34567'
}
View this message in context: http://groovy.329449.n5.nabble.com/Making-POST-requests-via-groovy-wslite-tp5712059p5712062.html
Sent from the groovy - dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
... {
type: ContentType.URLENC
urlenc cs:'12345,23456,34567'
}
I'm trying to use groovy-wslite to do some queries via the Atlassian
FishEye REST API. I'm an experienced Java programmer but a newbie to
Groovy and groovy-wslite.
I've got GET requests working fine. I'm trying to do my first POST,
/rest-service-fe/search-v1/reviewsForChangesets/{repo}
http://docs.atlassian.com/fisheye-crucible/latest/wadl/fisheye.html#d2e385
@Grab(group='com.github.groovy-wslite', module='groovy-wslite',
version='0.7.1')
import wslite.rest.*
def client = new RESTClient('http://server:port/context')
def response =
client.post(path:'/rest-service-fe/search-v1/reviewsForChangesets/repo?userName=user&password=password')
{
type: ContentType.URLENC
text { cs:'12345,23456,34567' } }
Caused by: java.io.IOException: Server returned HTTP response code: 500
http://crucible:8060/context/rest-service-fe/search-v1/reviewsForChangesets/BBNMS-JBBOS?userName=user&password=pass
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at
groovy.lang.MetaClassImpl$GetBeanMethodMetaProperty.getProperty(MetaClassImpl.java:3481)
at
org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:61)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
at wslite.http.HTTPClient.execute(HTTPClient.groovy:55)
I think my problem is knowing the correct way to write the closure that
represents the body of the POST.
Can anyone set me straight?
--FishEye REST API. I'm an experienced Java programmer but a newbie to
Groovy and groovy-wslite.
I've got GET requests working fine. I'm trying to do my first POST,
/rest-service-fe/search-v1/reviewsForChangesets/{repo}
http://docs.atlassian.com/fisheye-crucible/latest/wadl/fisheye.html#d2e385
@Grab(group='com.github.groovy-wslite', module='groovy-wslite',
version='0.7.1')
import wslite.rest.*
def client = new RESTClient('http://server:port/context')
def response =
client.post(path:'/rest-service-fe/search-v1/reviewsForChangesets/repo?userName=user&password=password')
{
type: ContentType.URLENC
text { cs:'12345,23456,34567' } }
Caused by: java.io.IOException: Server returned HTTP response code: 500
http://crucible:8060/context/rest-service-fe/search-v1/reviewsForChangesets/BBNMS-JBBOS?userName=user&password=pass
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at
groovy.lang.MetaClassImpl$GetBeanMethodMetaProperty.getProperty(MetaClassImpl.java:3481)
at
org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:61)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
at wslite.http.HTTPClient.execute(HTTPClient.groovy:55)
I think my problem is knowing the correct way to write the closure that
represents the body of the POST.
Can anyone set me straight?
View this message in context: http://groovy.329449.n5.nabble.com/Making-POST-requests-via-groovy-wslite-tp5712059p5712062.html
Sent from the groovy - dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email