---
title: "解决com.sun.xml.internal.ws.streaming.XMLStreamReaderException: unexpected XML t"
author: "cdxs2"
date: "2013-11-03T14:40:23Z"
tags: []
categories: ["编程语言"]
slug: "com-sun-xml-internal-ws-streaming-xmlstreamreaderexception-unexpected-xml-t"
draft: false
lastmod: "2013-11-03T14:40:23Z"
id: 1969340
url: "https://cdxs2.iteye.com/blog/1969340"
---

在开发前一篇文章中的handler的例子时遇到的问题，当我需要建立对应webservice的客户端时报了com.sun.xml.internal.ws.streaming.XMLStreamReaderException: unexpected XML tag.错误 

事实上问题就出在handler的实现上，当我实现SOAPHandler接口时，使用eclipse自动生成了借口定义的函数，而这些函数中其中有

```
@Override
public boolean handleMessage(SOAPMessageContext context) {
	return false;
}
```

 

自动生成时返回为false，而这个返回意味着，经过这个handler，当前的webservice将被终止处理，也就是说，webservice将不会有正常的返回，这也导致客户端要parse返回的SOAP消息时出现标签的识别错误。所以只要该成true就正常了。而且这个函数会被调用两次，一次是webservice的inbound，一次是outbound。