Results 1 to 4 of 4

Thread: Invalid Content-Type:text/html

  1. #1
    Join Date
    Apr 2008
    Posts
    5

    Default Invalid Content-Type:text/html

    This is the first time I want to call a web service with spring and tomcat.
    StreamSource source = new StreamSource(new StringReader(content));
    StringWriter resultSW = new StringWriter();
    StreamResult result = new StreamResult(resultSW);
    webServiceSender.sendSourceAndReceiveToResult(
    webServiceUrl,
    source,
    result
    );

    but I get this exception:
    Could not create message from InputStream: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Invalid Content-Type:text/html

    what is wrong?

  2. #2

    Default

    This is indeed an error message. Could you please give some more details:
    • The full stack trace
    • The content of the message
    • SOAP version you're using
    Tareq Abedrabbo

    My Twitter
    My Blog

  3. #3
    Join Date
    Apr 2008
    Posts
    5

    Default

    Whole stack trace
    message:Could not create message from InputStream: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    org.springframework.ws.soap.SoapMessageCreationExc eption: Could not create message from InputStream: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    at org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory.createWebServiceMessage(SaajSoapMessageFacto ry.java:180)
    at org.springframework.ws.transport.AbstractWebServic eConnection.receive(AbstractWebServiceConnection.j ava:53)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:410)
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:359)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:305)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:290)
    at com.intertek.webservice.outbound.spring.SpringWebS erviceSender.sendSourceAndReceiveToResult(SpringWe bServiceSender.java:26)
    at com.intertek.service.WSServiceImpl.sendWebService( WSServiceImpl.java:103)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:301)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:182)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :149)
    at org.springframework.aop.aspectj.MethodInvocationPr oceedingJoinPoint.proceed(MethodInvocationProceedi ngJoinPoint.java:77)
    at com.intertek.aop.SecurityCheck.doSecurityCheck(Sec urityCheck.java:19)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.aop.aspectj.AbstractAspectJAdv ice.invokeAdviceMethodWithGivenArgs(AbstractAspect JAdvice.java:627)
    at org.springframework.aop.aspectj.AbstractAspectJAdv ice.invokeAdviceMethod(AbstractAspectJAdvice.java: 616)
    at org.springframework.aop.aspectj.AspectJAroundAdvic e.invoke(AspectJAroundAdvice.java:64)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:106)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.interceptor.ExposeInvocati onInterceptor.invoke(ExposeInvocationInterceptor.j ava:89)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy33.sendWebService(Unknown Source)
    at com.intertek.webservice.outbound.service.DefaultOu tboundWebService.sendService(DefaultOutboundWebSer vice.java:73)
    at com.intertek.webservice.outbound.OutboundWebServic eManagerImpl.sendServices(OutboundWebServiceManage rImpl.java:23)
    at com.intertek.timer.OutboundWebServiceTask.run(Outb oundWebServiceTask.java:30)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)
    Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    at com.sun.xml.internal.messaging.saaj.soap.MessageIm pl.identifyContentType(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.MessageIm pl.<init>(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.Me ssage1_1Impl.<init>(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SO APMessageFactory1_1Impl.createMessage(Unknown Source)
    at org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory.createWebServiceMessage(SaajSoapMessageFacto ry.java:163)

    ------------------
    Content of message is just a cxml document :
    <cXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2.018" payloadID="ppp" timestamp="2008-04-23T08:04:11-05:00">
    <Header>
    <From>
    <Credential domain="NetworkId">
    <Identity>test</Identity>
    </Credential>
    <Credential domain="DUNS">
    <Identity>test</Identity>
    </Credential>
    </From>
    <To>
    <Credential domain="NetworkID">
    <Identity>test</Identity>
    </Credential>
    <Credential domain="SystemID">
    <Identity>test</Identity>
    </Credential>
    </To>
    <Sender>
    <Credential domain="NetworkID">
    <Identity>test</Identity>
    <SharedSecret>test</SharedSecret>
    </Credential>
    <UserAgent>Supplier</UserAgent>
    </Sender>
    </Header>
    <Request deploymentMode="production">
    <InvoiceDetailRequest>
    ............................
    </cxml>

    and the jar is spring-ws-core-1.0.3.jar

  4. #4

    Default

    You are probably receiving an html error page from the server (rather than a SOAP response). You might be using an incorrect url to access your web service. I'd suggest the following:
    • If you are using a wsdl to access your web service, make sure that your <service> element is pointing to the right place. You should look for something similar to <soap:address location="http://something:8080"/> and make sure that location points to where the service is.
    • Check the logs to see if there is an activity on the server when you invoke the service or if an exception is thrown
    • Use SoapUI (or something similar) to invoke the service and see what's the response really like. You can use tcpmon as well to monitor the exchange between the client and the server.
    Tareq Abedrabbo

    My Twitter
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •