Announcement Announcement Module
Collapse
No announcement yet.
Beginner question: InputStream invalid content type Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Beginner question: InputStream invalid content type

    HI,

    I'm wondering actually, since the stack below shows the message which is send, and this looks like a soap message. But there is this error which says me, that this looks more like html instead of Soap.

    So, while executing this:
    Code:
    LogServiceRequestDocument doc = LogServiceRequestDocument.Factory.newInstance();
    LogServiceRequest addNewLogServiceRequest = doc.addNewLogServiceRequest();
    		
    LogMessage logMessage = addNewLogServiceRequest.addNewLogMessage();
    logMessage.addMessageParameter(property);
    logMessage.setMessagekey(msgkey);
    logMessage.setApplication("asdf");
    getWebServiceTemplate().marshalSendAndReceive(doc);
    I get the following error:

    Code:
    686  [main] DEBUG org.springframework.ws.client.MessageTracing  - Sent request 
    [<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><sch:LogServiceRequest xmlns:sch="http://ch.glencore.com/logservice/schemas"><sch:LogMessage><sch:application>asdf</sch:application><sch:messagekey>key</sch:messagekey><sch:messageParameter>messageproperty</sch:messageParameter></sch:LogMessage></sch:LogServiceRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>]
    04.03.2008 11:01:29 com.sun.xml.internal.messaging.saaj.soap.MessageImpl identifyContentType SCHWERWIEGEND: SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP 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.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    org.springframework.ws.soap.SoapMessageCreationException: 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.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. I
    s this an error message instead of a SOAP response?
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.<init>(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.createMessage(Unknown Source)
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:163)
    at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:53)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:410)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:265)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:253)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:245)
    at com.glencore.ch.logservice.client.LogServiceClient.log(LogServiceClient.java:24)
    at com.glencore.ch.logservice.client.LogServiceClient.main(LogServiceClient.java:41)
    Code:
    part of my spring-ws-servlet.xml
    <bean id="LogService" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
    <property name="builder">
    <bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
    <property name="schema" value="classpath:schema\src\logservice-webservice\src\main\xsd\LogServiceSchema.xsd" />
    <property name="portTypeName" value="LogService" />
    <property name="targetNamespace" value="http://ch.glencore.com/logservice/definitions" />
    <property name="followIncludeImport" value="true" />
    <property name="locationUri" value="http://localhost:8080/logservice-webservice" />
    <property name="locationUri" value="${uri}" />
    </bean>
    </property>
    </bean>
    Does anyone have an idea ? isn't this strange , since the message sent is shown and this is SOAP ??

    thankx in advance
    regards
    marco persi

  • #2
    This means that the response message received is probably a html page with an error. You can use tcpmon to monitor what is sent and received.

    Comment


    • #3
      I have the same problem. How did you solve it?
      I am using tomcat 5.5 and Spring.
      This is my code:
      StreamSource source = new StreamSource(new StringReader(content));
      StringWriter resultSW = new StringWriter();
      StreamResult result = new StreamResult(resultSW);

      webServiceSender.sendSourceAndReceiveToResult(
      webServiceUrl,
      source,
      result
      );

      String resultStr = resultSW.toString();
      and the content is just a xml document.

      Comment


      • #4
        wrong namespace in WSDL

        My problem there was that I have used wrong namespaces(TargetNamespace) in XML Shema which generates the WSDL

        As Arjen explained, it really makes sense if you get a "sniffer" running and check what really comes over the cable

        cheers

        Comment

        Working...
        X