0

I'm sending a POST request via POSTMAN, but my server (WebServer) is receiving it as a GET request - can anyone think why this can happen? Here is some info from postman (part of the URL/hostnames annonymised):

POST /blaa/DescriptionEntities/description HTTP/1.1
Host: blaaa
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Postman-Token: 3901995b-78a0-598f-40d2-83b09e09d12e
id=20&description=hi

The code:

@POST
@Path("description")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
public DescriptionEntity      createDescriptionEntity(MultivaluedMap<String,String>map){


    System.out.println(map.getFirst("id"));
    System.out.println(map.getFirst("description"));
    return null;

}

The Server (WebSphere):

 No operation matching request path "/blaa/DescriptionEntities/description"      is found, Relative Path: /description, HTTP Method: GET, ContentType: */*, Accept: */*,. Please enable FINE/TRACE log level for more details-is anyone able to kindly help here. 

Not sure how to set the log level here either(I'm new to this).The relative path at the class level is "DescriptionEntities" Thanks so much.

EDIT- this is the whole class (minus import statements-it's completely experimental and ignore non related errors):

   @Path("DescriptionEntities")
   public class DescriptionEntityResource {
   private DescriptionEntityRepository descriptionEntityRepository=new       DescriptionEntityRepository();
    @Path("description")
    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
   public DescriptionEntity createDescriptionEntity(MultivaluedMap<String,String>map){


    System.out.println(map.getFirst("id"));
    System.out.println(map.getFirst("description"));
    return null;

}

}

And the URL in Postman: http://blaa/DescriptionEntities/Description

EDIT: Server.xml

  <server description="new server">
<!-- Enable features -->
<featureManager>
    <feature>jndi-1.0</feature>
    <feature>json-1.0</feature>
    <feature>localConnector-1.0</feature>
    <feature>appSecurity-2.0</feature>
    <feature>ssl-1.0</feature>
    <feature>servlet-3.1</feature>
    <feature>jaxrs-2.0</feature>
    <feature>jpa-2.1</feature>
    <feature>jsf-2.2</feature>
    <feature>jsp-2.3</feature>
</featureManager>

<httpEndpoint host="*" httpPort="80" httpsPort="443" id="defaultHttpEndpoint" sslOptionsRef="endpointSSLOptions"/> 
<sslOptions id="endpointSSLOptions" sslRef="endpointSSL"/>
<ssl enabledCiphers="TLS_RSA_WITH_AES_128_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA256 " id="endpointSSL" keyStoreRef="customKeyStore"/>
<keyStore id="defaultKeyStore" password="annonymised"/>
<basicRegistry/>

<mimeTypes>
    <type>svg=image/svg+xml</type>
</mimeTypes>

<httpSession useContextRootAsCookiePath="true" cookieSecure="true" />
<logging consoleLogLevel="INFO"/>
<applicationMonitor updateTrigger="mbean"/>

<webApplication id="annonymised" location="annonymised" name="annonymised"/>

EDIT: Network traffic (using fiddler):

POST /blaa/DescriptionEntities/description HTTP/1.1
Host: blaa
Connection: keep-alive
Content-Length: 20
Cache-Control: no-cache
Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
    Content-Type: application/x-www-form-urlencoded
 Accept: */*
 Accept-Encoding: gzip, deflate
 Accept-Language: en-US,en;q=0.8

EDIT: The GET request:

 GET /blaa/DescriptionEntities/description HTTP/1.1
 Host: blaa
 Connection: keep-alive
 Cache-Control: no-cache
 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36    (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
 Accept: */*
 Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8
Cookie: IBMISP=b645ef125eca11e6aeed1341c031a83e-   b645ef125eca11e6aeed1341c031a83e-0801740c1b0bc161a63c23e998bba6ec; CoreM_State=83~-1~-1~-1~-1~3~3~5~3~3~7~7~|~~|~~|~~|~||||||~|~~|~~|~~|~~|~~|~~|~~|~; CoreM_State_Content=6~|~~|~|; optimizelyEndUserId=oeu1470813611355r0.3187708418093793; ajs_user_id=null; ajs_group_id=null; amplitude_idibm.com=eyJkZXZpY2VJZCI6Ijk0ZGZlZWE0LTg4NjEtNDMzNi04Yzk5LWMyZWMwNjMxOGZmNFIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTQ3MDgxMzY4MDQ4MCwibGFzdEV2ZW50VGltZSI6MTQ3MDgxMzY4MDQ5MCwiZXZlbnRJZCI6MSwiaWRlbnRpZnlJZCI6MSwic2VxdWVuY2VOdW1iZXIiOjJ9; ajs_anonymous_id=%22b645ef125eca11e6aeed1341c031a83e%22; intercom-id=19922b40-fb41-4744-9dfb-89d6875c0294; UnicaNIODID=enSkfJ02Gh7-Z3dNjvn; optimizelySegments=%7B%222753990332%22%3A%22gc%22%2C%222757810742%22%3A%22search%22%2C%222762380326%22%3A%22false%22%2C%223081321317%22%3A%22none%22%2C%223855873690%22%3A%22referral%22%2C%223859505928%22%3A%22none%22%2C%223860673668%22%3A%22gc%22%2C%223861195110%22%3A%22false%22%7D; optimizelyBuckets=%7B%7D; cvo_sid1=EEHN9V3GC6UB; cvo_tid1=BF-jgeF2_Y4|1470813613|1471260957|0; mmcore.tst=0.794; mmapi.store.p.0=%7B%22mmparams.d%22%3A%7B%7D%2C%22mmparams.p%22%3A%7B%22mmid%22%3A%221502797170504%7C%5C%22716298243%7CCgAAAApStaCTtQ0AAA%3D%3D%5C%22%22%2C%22pd%22%3A%221502797170506%7C%5C%22-1893569528%7CCgAAAAoBQlK1oJO1DfyoSkgDAOpF09EAxdNIDwAAABoXwicJwdNIAAAAAP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FAAZEaXJlY3QBtQ0DAAAAAAAAAAAAAP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwAAAAAAAUU%3D%5C%22%22%2C%22srv%22%3A%221502797170510%7C%5C%22ldnvwcgus01%5C%22%22%7D%7D; __auc=f59597cf1567352a7c8a1f92cde; _ga=GA1.2.1447575942.1471939647; CoreID6=67988125510914708136127&ci=50200000|Bluemix_51040000|IBMTESTW3_51040000|HR_50200000|IBM_GlobalMarketing_50200000|devwrkscon_50200000|ESTKCS_50200000|DWNEXT; utag_main=v_id:01567352a47a000fc70d49709b1a04072002b06a00718$_sn:4$_ss:0$_st:1471941446924$dc_visit:4$_pn:7%3Bexp-session$ses_id:1471937020076%3Bexp-session$dc_event:19%3Bexp-session$dc_region:eu-central-1%3Bexp-session$ttd_uuid:f57e787f-a10b-48bc-833c-add2cf0e063d%3Bexp-session; 50200000_clogin=v=1&l=1471937020&e=1471941448777

EDIT: I have purged this little test project for now as I can't figure out what's wrong. I may try another time a little further down the line. Still curious as to what went wrong though so let me know if you spot anything obvious. Thanks everyone

E Shindler
  • 425
  • 7
  • 27
  • 1
    I'm getting a status 302 when turning on the interceptor in Postman....can anyone tell me why the redeirect is being attempted? – E Shindler Aug 22 '16 at 12:30
  • @DanielBarbarian as far as I understand, if the interceptor is turned off (interceptor prevents redirection) it's just attempting a GET request to that same URL, so instead of performing the POST, it's attempting to perform a GET and then failing as there is no such GET request. Any leads will be greatly appreciated-thanks! – E Shindler Aug 22 '16 at 13:08
  • The only thing I was thinking was that if the page requires authentication and none was provided. That could trigger a redirect, but usually not to the same page though. – DanielBarbarian Aug 22 '16 at 13:22
  • @DanielBarbarian Do you have any fellow WebSphere/JAXRS experts you could ask? This one is starting to annoy me now :) – E Shindler Aug 22 '16 at 13:59
  • 1
    Enable developer tools and capture the network requests. Something is causing a redirect, which of course causes a GET. The 302 redirect response will have a Location header. Look at your WebSphere logs as well. And what version of WebSphere? – dbreaux Aug 23 '16 at 00:05
  • 1
    I meant your browser developer tools. F12. You can watch the network requests there. Like your Fiddler output, but from just the base browser. Your Fiddler output shows only a single request, and no response. Do you have the response also? And clearly a GET was sent at some point. – dbreaux Aug 23 '16 at 16:08
  • 1
    (I'm also assuming your `/blaa` in the first example and `/annonymised` in the second one are your web application's context root?) – dbreaux Aug 23 '16 at 19:36
  • 1
    @dbreux Yes. Added the get request. I've noticed that the get request is coming through as HTTPS an the 302 as HTTP. Could it be a Postman config thing? Really confused here. Thank you for your help. – E Shindler Aug 24 '16 at 05:49
  • No, but an equivalent GET to same URL works. Will be back at this tomorrow morning (time for me to leave work now). Thanks very much – E Shindler Aug 24 '16 at 14:00

0 Answers0