• Post Reply Bookmark Topic Watch Topic
  • New Topic

Bad response error while requesting web service of informetica  RSS feed

 
Chaitanya ekre
Greenhorn
Posts: 13
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am sending request to web service of informetica. The code snippet is -

MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();

SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.setPrefix("soap");
envelope.removeNamespaceDeclaration("SOAP-ENV");
envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");

envelope.getHeader().setPrefix("soap");

SOAPBody soapBody = envelope.getBody();
soapBody.setPrefix("soap");
soapBody.setAttribute("xmlns:ns0", "http://www.informatica.com/wsh");

SOAPElement soapBodyElem = soapBody.addChildElement("Login", "ns0");

SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("RepositoryDomainName");
soapBodyElem1.addTextNode("value");

SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("RepositoryName");
soapBodyElem2.addTextNode("value");

SOAPElement soapBodyElem3 = soapBodyElem.addChildElement("UserName");
soapBodyElem3.addTextNode("value");

SOAPElement soapBodyElem4 = soapBodyElem.addChildElement("Password");
soapBodyElem4.addTextNode("value");

SOAPElement soapBodyElem5 = soapBodyElem.addChildElement("UserNameSpace");
soapBodyElem5.addTextNode("value");

soapMessage.saveChanges();

OutputStream baos = new ByteArrayOutputStream();
soapMessage.writeTo(baos);
instanceLog.info(baos.toString());

SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();

String url = "http://www.informatica.com/wsh";
SOAPMessage soapResponse = soapConnection.call(soapMessage, url);


But every time i am getting exception as -

Jun 08, 2016 4:38:55 PM com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPC
onnection post
SEVERE: SAAJ0008: Bad Response; Moved Permanently
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.mess
aging.saaj.SOAPExceptionImpl: Bad response: (301Moved Permanently
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.cal
l(HttpSOAPConnection.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMet
hodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:230)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMeta
MethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSi
teArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:128)
at Script1.run(Script1.groovy:60)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:627)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:598)
at com.ice.bpel.BpelRule.runRuleByGroovyScript(BpelRule.java:7916)
at com.ice.bpel.ScriptProcess.call(ScriptProcess.java:69)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response:
(301Moved Permanently
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.pos
t(HttpSOAPConnection.java:257)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.cal
l(HttpSOAPConnection.java:144)
... 19 more

CAUSE:

com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (301Moved P
ermanently
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.pos
t(HttpSOAPConnection.java:257)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.cal
l(HttpSOAPConnection.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMet
hodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:230)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMeta
MethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSi
teArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:128)
at Script1.run(Script1.groovy:60)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:627)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:598)
at com.ice.bpel.BpelRule.runRuleByGroovyScript(BpelRule.java:7916)
at com.ice.bpel.ScriptProcess.call(ScriptProcess.java:69)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:745)

CAUSE:

com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (301Moved P
ermanently
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.pos
t(HttpSOAPConnection.java:257)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.cal
l(HttpSOAPConnection.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMet
hodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:230)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMeta
MethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSi
teArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:128)
at Script1.run(Script1.groovy:60)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:627)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:598)
at com.ice.bpel.BpelRule.runRuleByGroovyScript(BpelRule.java:7916)
at com.ice.bpel.ScriptProcess.call(ScriptProcess.java:69)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:745)
Jun 08, 2016 4:38:56 PM com.ice.bpel.ScriptProcess call






when xml request is given to the tool that will generate response as success with login session id.
Is there anything i am missing.

Thanks in advance.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!