1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.panels.request.components;
14
15 import java.beans.PropertyChangeEvent;
16 import java.beans.PropertyChangeListener;
17
18 import org.apache.xmlbeans.SchemaTypeSystem;
19 import org.apache.xmlbeans.XmlBeans;
20
21 import com.eviware.soapui.impl.wsdl.WsdlInterface;
22 import com.eviware.soapui.impl.wsdl.WsdlRequest;
23 import com.eviware.soapui.impl.wsdl.panels.request.components.editor.support.AbstractXmlDocument;
24 import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext;
25
26 public class RequestXmlDocument extends AbstractXmlDocument implements PropertyChangeListener
27 {
28 private final WsdlRequest request;
29 private boolean updating;
30
31 public RequestXmlDocument(WsdlRequest request)
32 {
33 this.request = request;
34 request.addPropertyChangeListener( WsdlRequest.REQUEST_PROPERTY, this );
35 }
36
37 public String getXml()
38 {
39 return request.getRequestContent();
40 }
41
42 public void setXml(String xml)
43 {
44 request.setRequestContent( xml );
45 }
46
47 public void propertyChange(PropertyChangeEvent evt)
48 {
49 if( !updating )
50 fireXmlChanged( (String)evt.getOldValue(), (String)evt.getNewValue() );
51 }
52
53 public SchemaTypeSystem getTypeSystem()
54 {
55 WsdlInterface iface = (WsdlInterface) request.getOperation().getInterface();
56 WsdlContext wsdlContext = iface.getWsdlContext();
57 try
58 {
59 return wsdlContext.getSchemaTypeSystem();
60 }
61 catch (Exception e1)
62 {
63 e1.printStackTrace();
64 return XmlBeans.getBuiltinTypeSystem();
65 }
66 }
67 }