1、 下载axis2版本http://axis.apache.org/axis2/java/core/download.html
2、下载完成后解压,打开命令行,进入bin目录下,执行命令:
${installdir}>WSDL2Java -uri http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws?wsdl -p com.pcm.framework.utils -d adb -s
生成的代码则存储在bin\src下;
Note:生成前,java环境必须正常;
生成的代码:
1 /** 2 * CarrySLPOSServiceStub.java 3 * 4 * This file was auto-generated from WSDL 5 * by the Apache Axis2 version: 1.7.0 Built on : Jan 18, 2016 (09:41:27 GMT) 6 */ 7 package com.pcm.framework.utils; 8 9 10 /* 11 * CarrySLPOSServiceStub java implementation 12 */ 13 public class CarrySLPOSServiceStub extends org.apache.axis2.client.Stub { 14 private static int counter = 0; 15 protected org.apache.axis2.description.AxisOperation[] _operations; 16 17 //hashmaps to keep the fault mapping 18 private java.util.HashMap faultExceptionNameMap = new java.util.HashMap(); 19 private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap(); 20 private java.util.HashMap faultMessageMap = new java.util.HashMap(); 21 private javax.xml.namespace.QName[] opNameArray = null; 22 23 /** 24 *Constructor that takes in a configContext 25 */ 26 public CarrySLPOSServiceStub( 27 org.apache.axis2.context.ConfigurationContext configurationContext, 28 java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault { 29 this(configurationContext, targetEndpoint, false); 30 } 31 32 /** 33 * Constructor that takes in a configContext and useseperate listner 34 */ 35 public CarrySLPOSServiceStub( 36 org.apache.axis2.context.ConfigurationContext configurationContext, 37 java.lang.String targetEndpoint, boolean useSeparateListener) 38 throws org.apache.axis2.AxisFault { 39 //To populate AxisService 40 populateAxisService(); 41 populateFaults(); 42 43 _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext, 44 _service); 45 46 _serviceClient.getOptions() 47 .setTo(new org.apache.axis2.addressing.EndpointReference( 48 targetEndpoint)); 49 _serviceClient.getOptions().setUseSeparateListener(useSeparateListener); 50 } 51 52 /** 53 * Default Constructor 54 */ 55 public CarrySLPOSServiceStub( 56 org.apache.axis2.context.ConfigurationContext configurationContext) 57 throws org.apache.axis2.AxisFault { 58 this(configurationContext, 59 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws"); 60 } 61 62 /** 63 * Default Constructor 64 */ 65 public CarrySLPOSServiceStub() throws org.apache.axis2.AxisFault { 66 this("http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws"); 67 } 68 69 /** 70 * Constructor taking the target endpoint 71 */ 72 public CarrySLPOSServiceStub(java.lang.String targetEndpoint) 73 throws org.apache.axis2.AxisFault { 74 this(null, targetEndpoint); 75 } 76 77 private static synchronized java.lang.String getUniqueSuffix() { 78 // reset the counter if it is greater than 99999 79 if (counter > 99999) { 80 counter = 0; 81 } 82 83 counter = counter + 1; 84 85 return java.lang.Long.toString(java.lang.System.currentTimeMillis()) + 86 "_" + counter; 87 } 88 89 private void populateAxisService() throws org.apache.axis2.AxisFault { 90 //creating the Service with a unique name 91 _service = new org.apache.axis2.description.AxisService( 92 "CarrySLPOSService" + getUniqueSuffix()); 93 addAnonymousOperations(); 94 95 //creating the operations 96 org.apache.axis2.description.AxisOperation __operation; 97 98 _operations = new org.apache.axis2.description.AxisOperation[2]; 99 100 __operation = new org.apache.axis2.description.OutInAxisOperation(); 101 102 __operation.setName(new javax.xml.namespace.QName( 103 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws", 104 "writeYDPosYHJK_ZJJK")); 105 _service.addOperation(__operation); 106 107 _operations[0] = __operation; 108 109 __operation = new org.apache.axis2.description.OutInAxisOperation(); 110 111 __operation.setName(new javax.xml.namespace.QName( 112 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws", 113 "writeYDPosYHJK")); 114 _service.addOperation(__operation); 115 116 _operations[1] = __operation; 117 } 118 119 //populates the faults 120 private void populateFaults() { 121 } 122 123 /** 124 * Auto generated method signature 125 * 126 * @see com.pcm.framework.utils.CarrySLPOSService#writeYDPosYHJK_ZJJK 127 * @param writeYDPosYHJK_ZJJK 128 */ 129 public com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJKResponse writeYDPosYHJK_ZJJK( 130 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJK writeYDPosYHJK_ZJJK) 131 throws java.rmi.RemoteException { 132 org.apache.axis2.context.MessageContext _messageContext = null; 133 134 try { 135 org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName()); 136 _operationClient.getOptions() 137 .setAction("http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws/CarrySLPOS/writeYDPosYHJK_ZJJKRequest"); 138 _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); 139 140 addPropertyToOperationClient(_operationClient, 141 org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, 142 "&"); 143 144 // create a message context 145 _messageContext = new org.apache.axis2.context.MessageContext(); 146 147 // create SOAP envelope with that payload 148 org.apache.axiom.soap.SOAPEnvelope env = null; 149 150 env = toEnvelope(getFactory(_operationClient.getOptions() 151 .getSoapVersionURI()), 152 writeYDPosYHJK_ZJJK, 153 optimizeContent( 154 new javax.xml.namespace.QName( 155 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws", 156 "writeYDPosYHJK_ZJJK")), 157 new javax.xml.namespace.QName("http://DefaultNamespace", 158 "writeYDPosYHJK_ZJJK")); 159 160 //adding SOAP soap_headers 161 _serviceClient.addHeadersToEnvelope(env); 162 // set the message context with that soap envelope 163 _messageContext.setEnvelope(env); 164 165 // add the message contxt to the operation client 166 _operationClient.addMessageContext(_messageContext); 167 168 //execute the operation client 169 _operationClient.execute(true); 170 171 org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE); 172 org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); 173 174 java.lang.Object object = fromOM(_returnEnv.getBody() 175 .getFirstElement(), 176 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJKResponse.class); 177 178 return (com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJKResponse) object; 179 } catch (org.apache.axis2.AxisFault f) { 180 org.apache.axiom.om.OMElement faultElt = f.getDetail(); 181 182 if (faultElt != null) { 183 if (faultExceptionNameMap.containsKey( 184 new org.apache.axis2.client.FaultMapKey( 185 faultElt.getQName(), "writeYDPosYHJK_ZJJK"))) { 186 //make the fault by reflection 187 try { 188 java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey( 189 faultElt.getQName(), "writeYDPosYHJK_ZJJK")); 190 java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); 191 java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class); 192 java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage()); 193 194 //message class 195 java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey( 196 faultElt.getQName(), "writeYDPosYHJK_ZJJK")); 197 java.lang.Class messageClass = java.lang.Class.forName(messageClassName); 198 java.lang.Object messageObject = fromOM(faultElt, 199 messageClass); 200 java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", 201 new java.lang.Class[] { messageClass }); 202 m.invoke(ex, new java.lang.Object[] { messageObject }); 203 204 throw new java.rmi.RemoteException(ex.getMessage(), ex); 205 } catch (java.lang.ClassCastException e) { 206 // we cannot intantiate the class - throw the original Axis fault 207 throw f; 208 } catch (java.lang.ClassNotFoundException e) { 209 // we cannot intantiate the class - throw the original Axis fault 210 throw f; 211 } catch (java.lang.NoSuchMethodException e) { 212 // we cannot intantiate the class - throw the original Axis fault 213 throw f; 214 } catch (java.lang.reflect.InvocationTargetException e) { 215 // we cannot intantiate the class - throw the original Axis fault 216 throw f; 217 } catch (java.lang.IllegalAccessException e) { 218 // we cannot intantiate the class - throw the original Axis fault 219 throw f; 220 } catch (java.lang.InstantiationException e) { 221 // we cannot intantiate the class - throw the original Axis fault 222 throw f; 223 } 224 } else { 225 throw f; 226 } 227 } else { 228 throw f; 229 } 230 } finally { 231 if (_messageContext.getTransportOut() != null) { 232 _messageContext.getTransportOut().getSender() 233 .cleanup(_messageContext); 234 } 235 } 236 } 237 238 /** 239 * Auto generated method signature 240 * 241 * @see com.pcm.framework.utils.CarrySLPOSService#writeYDPosYHJK 242 * @param writeYDPosYHJK 243 */ 244 public com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJKResponse writeYDPosYHJK( 245 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK writeYDPosYHJK) 246 throws java.rmi.RemoteException { 247 org.apache.axis2.context.MessageContext _messageContext = null; 248 249 try { 250 org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName()); 251 _operationClient.getOptions() 252 .setAction("http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws/CarrySLPOS/writeYDPosYHJKRequest"); 253 _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); 254 255 addPropertyToOperationClient(_operationClient, 256 org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, 257 "&"); 258 259 // create a message context 260 _messageContext = new org.apache.axis2.context.MessageContext(); 261 262 // create SOAP envelope with that payload 263 org.apache.axiom.soap.SOAPEnvelope env = null; 264 265 env = toEnvelope(getFactory(_operationClient.getOptions() 266 .getSoapVersionURI()), 267 writeYDPosYHJK, 268 optimizeContent( 269 new javax.xml.namespace.QName( 270 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws", 271 "writeYDPosYHJK")), 272 new javax.xml.namespace.QName("http://DefaultNamespace", 273 "writeYDPosYHJK")); 274 275 //adding SOAP soap_headers 276 _serviceClient.addHeadersToEnvelope(env); 277 // set the message context with that soap envelope 278 _messageContext.setEnvelope(env); 279 280 // add the message contxt to the operation client 281 _operationClient.addMessageContext(_messageContext); 282 283 //execute the operation client 284 _operationClient.execute(true); 285 286 org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE); 287 org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); 288 289 java.lang.Object object = fromOM(_returnEnv.getBody() 290 .getFirstElement(), 291 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJKResponse.class); 292 293 return (com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJKResponse) object; 294 } catch (org.apache.axis2.AxisFault f) { 295 org.apache.axiom.om.OMElement faultElt = f.getDetail(); 296 297 if (faultElt != null) { 298 if (faultExceptionNameMap.containsKey( 299 new org.apache.axis2.client.FaultMapKey( 300 faultElt.getQName(), "writeYDPosYHJK"))) { 301 //make the fault by reflection 302 try { 303 java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey( 304 faultElt.getQName(), "writeYDPosYHJK")); 305 java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); 306 java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class); 307 java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage()); 308 309 //message class 310 java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey( 311 faultElt.getQName(), "writeYDPosYHJK")); 312 java.lang.Class messageClass = java.lang.Class.forName(messageClassName); 313 java.lang.Object messageObject = fromOM(faultElt, 314 messageClass); 315 java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", 316 new java.lang.Class[] { messageClass }); 317 m.invoke(ex, new java.lang.Object[] { messageObject }); 318 319 throw new java.rmi.RemoteException(ex.getMessage(), ex); 320 } catch (java.lang.ClassCastException e) { 321 // we cannot intantiate the class - throw the original Axis fault 322 throw f; 323 } catch (java.lang.ClassNotFoundException e) { 324 // we cannot intantiate the class - throw the original Axis fault 325 throw f; 326 } catch (java.lang.NoSuchMethodException e) { 327 // we cannot intantiate the class - throw the original Axis fault 328 throw f; 329 } catch (java.lang.reflect.InvocationTargetException e) { 330 // we cannot intantiate the class - throw the original Axis fault 331 throw f; 332 } catch (java.lang.IllegalAccessException e) { 333 // we cannot intantiate the class - throw the original Axis fault 334 throw f; 335 } catch (java.lang.InstantiationException e) { 336 // we cannot intantiate the class - throw the original Axis fault 337 throw f; 338 } 339 } else { 340 throw f; 341 } 342 } else { 343 throw f; 344 } 345 } finally { 346 if (_messageContext.getTransportOut() != null) { 347 _messageContext.getTransportOut().getSender() 348 .cleanup(_messageContext); 349 } 350 } 351 } 352 353 private boolean optimizeContent(javax.xml.namespace.QName opName) { 354 if (opNameArray == null) { 355 return false; 356 } 357 358 for (int i = 0; i < opNameArray.length; i++) { 359 if (opName.equals(opNameArray[i])) { 360 return true; 361 } 362 } 363 364 return false; 365 } 366 367 private org.apache.axiom.om.OMElement toOM( 368 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJK param, 369 boolean optimizeContent) throws org.apache.axis2.AxisFault { 370 try { 371 return param.getOMElement(com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJK.MY_QNAME, 372 org.apache.axiom.om.OMAbstractFactory.getOMFactory()); 373 } catch (org.apache.axis2.databinding.ADBException e) { 374 throw org.apache.axis2.AxisFault.makeFault(e); 375 } 376 } 377 378 private org.apache.axiom.om.OMElement toOM( 379 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJKResponse param, 380 boolean optimizeContent) throws org.apache.axis2.AxisFault { 381 try { 382 return param.getOMElement(com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJKResponse.MY_QNAME, 383 org.apache.axiom.om.OMAbstractFactory.getOMFactory()); 384 } catch (org.apache.axis2.databinding.ADBException e) { 385 throw org.apache.axis2.AxisFault.makeFault(e); 386 } 387 } 388 389 private org.apache.axiom.om.OMElement toOM( 390 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK param, 391 boolean optimizeContent) throws org.apache.axis2.AxisFault { 392 try { 393 return param.getOMElement(com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK.MY_QNAME, 394 org.apache.axiom.om.OMAbstractFactory.getOMFactory()); 395 } catch (org.apache.axis2.databinding.ADBException e) { 396 throw org.apache.axis2.AxisFault.makeFault(e); 397 } 398 } 399 400 private org.apache.axiom.om.OMElement toOM( 401 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJKResponse param, 402 boolean optimizeContent) throws org.apache.axis2.AxisFault { 403 try { 404 return param.getOMElement(com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJKResponse.MY_QNAME, 405 org.apache.axiom.om.OMAbstractFactory.getOMFactory()); 406 } catch (org.apache.axis2.databinding.ADBException e) { 407 throw org.apache.axis2.AxisFault.makeFault(e); 408 } 409 } 410 411 private org.apache.axiom.soap.SOAPEnvelope toEnvelope( 412 org.apache.axiom.soap.SOAPFactory factory, 413 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJK param, 414 boolean optimizeContent, javax.xml.namespace.QName elementQName) 415 throws org.apache.axis2.AxisFault { 416 try { 417 org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); 418 emptyEnvelope.getBody() 419 .addChild(param.getOMElement( 420 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJK.MY_QNAME, 421 factory)); 422 423 return emptyEnvelope; 424 } catch (org.apache.axis2.databinding.ADBException e) { 425 throw org.apache.axis2.AxisFault.makeFault(e); 426 } 427 } 428 429 /* methods to provide back word compatibility */ 430 private org.apache.axiom.soap.SOAPEnvelope toEnvelope( 431 org.apache.axiom.soap.SOAPFactory factory, 432 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK param, 433 boolean optimizeContent, javax.xml.namespace.QName elementQName) 434 throws org.apache.axis2.AxisFault { 435 try { 436 org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); 437 emptyEnvelope.getBody() 438 .addChild(param.getOMElement( 439 com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK.MY_QNAME, 440 factory)); 441 442 return emptyEnvelope; 443 } catch (org.apache.axis2.databinding.ADBException e) { 444 throw org.apache.axis2.AxisFault.makeFault(e); 445 } 446 } 447 448 /* methods to provide back word compatibility */ 449 450 /** 451 * get the default envelope 452 */ 453 private org.apache.axiom.soap.SOAPEnvelope toEnvelope( 454 org.apache.axiom.soap.SOAPFactory factory) { 455 return factory.getDefaultEnvelope(); 456 } 457 458 private java.lang.Object fromOM(org.apache.axiom.om.OMElement param, 459 java.lang.Class type) throws org.apache.axis2.AxisFault { 460 try { 461 if (com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK.class.equals( 462 type)) { 463 return com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK.Factory.parse(param.getXMLStreamReaderWithoutCaching()); 464 } 465 466 if (com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJK.class.equals( 467 type)) { 468 return com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJK.Factory.parse(param.getXMLStreamReaderWithoutCaching()); 469 } 470 471 if (com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJKResponse.class.equals( 472 type)) { 473 return com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJK_ZJJKResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); 474 } 475 476 if (com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJKResponse.class.equals( 477 type)) { 478 return com.pcm.framework.utils.CarrySLPOSServiceStub.WriteYDPosYHJKResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); 479 } 480 } catch (java.lang.Exception e) { 481 throw org.apache.axis2.AxisFault.makeFault(e); 482 } 483 484 return null; 485 } 486 487 //http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws 488 public static class WriteYDPosYHJK_ZJJKResponse implements org.apache.axis2.databinding.ADBBean { 489 public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws", 490 "writeYDPosYHJK_ZJJKResponse", "ns1"); 491 492 /** 493 * field for WriteYDPosYHJK_ZJJKReturn 494 */ 495 protected java.lang.String localWriteYDPosYHJK_ZJJKReturn; 496 497 /** 498 * Auto generated getter method 499 * @return java.lang.String 500 */ 501 public java.lang.String getWriteYDPosYHJK_ZJJKReturn() { 502 return localWriteYDPosYHJK_ZJJKReturn; 503 } 504 505 /** 506 * Auto generated setter method 507 * @param param WriteYDPosYHJK_ZJJKReturn 508 */ 509 public void setWriteYDPosYHJK_ZJJKReturn(java.lang.String param) { 510 this.localWriteYDPosYHJK_ZJJKReturn = param; 511 } 512 513 /** 514 * 515 * @param parentQName 516 * @param factory 517 * @return org.apache.axiom.om.OMElement 518 */ 519 public org.apache.axiom.om.OMElement getOMElement( 520 final javax.xml.namespace.QName parentQName, 521 final org.apache.axiom.om.OMFactory factory) 522 throws org.apache.axis2.databinding.ADBException { 523 return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( 524 this, MY_QNAME)); 525 } 526 527 public void serialize(final javax.xml.namespace.QName parentQName, 528 javax.xml.stream.XMLStreamWriter xmlWriter) 529 throws javax.xml.stream.XMLStreamException, 530 org.apache.axis2.databinding.ADBException { 531 serialize(parentQName, xmlWriter, false); 532 } 533 534 public void serialize(final javax.xml.namespace.QName parentQName, 535 javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) 536 throws javax.xml.stream.XMLStreamException, 537 org.apache.axis2.databinding.ADBException { 538 java.lang.String prefix = null; 539 java.lang.String namespace = null; 540 541 prefix = parentQName.getPrefix(); 542 namespace = parentQName.getNamespaceURI(); 543 writeStartElement(prefix, namespace, parentQName.getLocalPart(), 544 xmlWriter); 545 546 if (serializeType) { 547 java.lang.String namespacePrefix = registerPrefix(xmlWriter, 548 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws"); 549 550 if ((namespacePrefix != null) && 551 (namespacePrefix.trim().length() > 0)) { 552 writeAttribute("xsi", 553 "http://www.w3.org/2001/XMLSchema-instance", "type", 554 namespacePrefix + ":writeYDPosYHJK_ZJJKResponse", 555 xmlWriter); 556 } else { 557 writeAttribute("xsi", 558 "http://www.w3.org/2001/XMLSchema-instance", "type", 559 "writeYDPosYHJK_ZJJKResponse", xmlWriter); 560 } 561 } 562 563 namespace = "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws"; 564 writeStartElement(null, namespace, "writeYDPosYHJK_ZJJKReturn", 565 xmlWriter); 566 567 if (localWriteYDPosYHJK_ZJJKReturn == null) { 568 // write the nil attribute 569 writeAttribute("xsi", 570 "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", 571 xmlWriter); 572 } else { 573 xmlWriter.writeCharacters(localWriteYDPosYHJK_ZJJKReturn); 574 } 575 576 xmlWriter.writeEndElement(); 577 578 xmlWriter.writeEndElement(); 579 } 580 581 private static java.lang.String generatePrefix( 582 java.lang.String namespace) { 583 if (namespace.equals( 584 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws")) { 585 return "ns1"; 586 } 587 588 return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); 589 } 590 591 /** 592 * Utility method to write an element start tag. 593 */ 594 private void writeStartElement(java.lang.String prefix, 595 java.lang.String namespace, java.lang.String localPart, 596 javax.xml.stream.XMLStreamWriter xmlWriter) 597 throws javax.xml.stream.XMLStreamException { 598 java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); 599 600 if (writerPrefix != null) { 601 xmlWriter.writeStartElement(writerPrefix, localPart, namespace); 602 } else { 603 if (namespace.length() == 0) { 604 prefix = ""; 605 } else if (prefix == null) { 606 prefix = generatePrefix(namespace); 607 } 608 609 xmlWriter.writeStartElement(prefix, localPart, namespace); 610 xmlWriter.writeNamespace(prefix, namespace); 611 xmlWriter.setPrefix(prefix, namespace); 612 } 613 } 614 615 /** 616 * Util method to write an attribute with the ns prefix 617 */ 618 private void writeAttribute(java.lang.String prefix, 619 java.lang.String namespace, java.lang.String attName, 620 java.lang.String attValue, 621 javax.xml.stream.XMLStreamWriter xmlWriter) 622 throws javax.xml.stream.XMLStreamException { 623 java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); 624 625 if (writerPrefix != null) { 626 xmlWriter.writeAttribute(writerPrefix, namespace, attName, 627 attValue); 628 } else { 629 xmlWriter.writeNamespace(prefix, namespace); 630 xmlWriter.setPrefix(prefix, namespace); 631 xmlWriter.writeAttribute(prefix, namespace, attName, attValue); 632 } 633 } 634 635 /** 636 * Util method to write an attribute without the ns prefix 637 */ 638 private void writeAttribute(java.lang.String namespace, 639 java.lang.String attName, java.lang.String attValue, 640 javax.xml.stream.XMLStreamWriter xmlWriter) 641 throws javax.xml.stream.XMLStreamException { 642 if (namespace.equals("")) { 643 xmlWriter.writeAttribute(attName, attValue); 644 } else { 645 xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), 646 namespace, attName, attValue); 647 } 648 } 649 650 /** 651 * Util method to write an attribute without the ns prefix 652 */ 653 private void writeQNameAttribute(java.lang.String namespace, 654 java.lang.String attName, javax.xml.namespace.QName qname, 655 javax.xml.stream.XMLStreamWriter xmlWriter) 656 throws javax.xml.stream.XMLStreamException { 657 java.lang.String attributeNamespace = qname.getNamespaceURI(); 658 java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); 659 660 if (attributePrefix == null) { 661 attributePrefix = registerPrefix(xmlWriter, attributeNamespace); 662 } 663 664 java.lang.String attributeValue; 665 666 if (attributePrefix.trim().length() > 0) { 667 attributeValue = attributePrefix + ":" + qname.getLocalPart(); 668 } else { 669 attributeValue = qname.getLocalPart(); 670 } 671 672 if (namespace.equals("")) { 673 xmlWriter.writeAttribute(attName, attributeValue); 674 } else { 675 registerPrefix(xmlWriter, namespace); 676 xmlWriter.writeAttribute(attributePrefix, namespace, attName, 677 attributeValue); 678 } 679 } 680 681 /** 682 * method to handle Qnames 683 */ 684 private void writeQName(javax.xml.namespace.QName qname, 685 javax.xml.stream.XMLStreamWriter xmlWriter) 686 throws javax.xml.stream.XMLStreamException { 687 java.lang.String namespaceURI = qname.getNamespaceURI(); 688 689 if (namespaceURI != null) { 690 java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); 691 692 if (prefix == null) { 693 prefix = generatePrefix(namespaceURI); 694 xmlWriter.writeNamespace(prefix, namespaceURI); 695 xmlWriter.setPrefix(prefix, namespaceURI); 696 } 697 698 if (prefix.trim().length() > 0) { 699 xmlWriter.writeCharacters(prefix + ":" + 700 org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 701 qname)); 702 } else { 703 // i.e this is the default namespace 704 xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 705 qname)); 706 } 707 } else { 708 xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 709 qname)); 710 } 711 } 712 713 private void writeQNames(javax.xml.namespace.QName[] qnames, 714 javax.xml.stream.XMLStreamWriter xmlWriter) 715 throws javax.xml.stream.XMLStreamException { 716 if (qnames != null) { 717 // we have to store this data until last moment since it is not possible to write any 718 // namespace data after writing the charactor data 719 java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); 720 java.lang.String namespaceURI = null; 721 java.lang.String prefix = null; 722 723 for (int i = 0; i < qnames.length; i++) { 724 if (i > 0) { 725 stringToWrite.append(" "); 726 } 727 728 namespaceURI = qnames[i].getNamespaceURI(); 729 730 if (namespaceURI != null) { 731 prefix = xmlWriter.getPrefix(namespaceURI); 732 733 if ((prefix == null) || (prefix.length() == 0)) { 734 prefix = generatePrefix(namespaceURI); 735 xmlWriter.writeNamespace(prefix, namespaceURI); 736 xmlWriter.setPrefix(prefix, namespaceURI); 737 } 738 739 if (prefix.trim().length() > 0) { 740 stringToWrite.append(prefix).append(":") 741 .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 742 qnames[i])); 743 } else { 744 stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 745 qnames[i])); 746 } 747 } else { 748 stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 749 qnames[i])); 750 } 751 } 752 753 xmlWriter.writeCharacters(stringToWrite.toString()); 754 } 755 } 756 757 /** 758 * Register a namespace prefix 759 */ 760 private java.lang.String registerPrefix( 761 javax.xml.stream.XMLStreamWriter xmlWriter, 762 java.lang.String namespace) 763 throws javax.xml.stream.XMLStreamException { 764 java.lang.String prefix = xmlWriter.getPrefix(namespace); 765 766 if (prefix == null) { 767 prefix = generatePrefix(namespace); 768 769 javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); 770 771 while (true) { 772 java.lang.String uri = nsContext.getNamespaceURI(prefix); 773 774 if ((uri == null) || (uri.length() == 0)) { 775 break; 776 } 777 778 prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); 779 } 780 781 xmlWriter.writeNamespace(prefix, namespace); 782 xmlWriter.setPrefix(prefix, namespace); 783 } 784 785 return prefix; 786 } 787 788 /** 789 * Factory class that keeps the parse method 790 */ 791 public static class Factory { 792 private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); 793 794 /** 795 * static method to create the object 796 * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable 797 * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element 798 * Postcondition: If this object is an element, the reader is positioned at its end element 799 * If this object is a complex type, the reader is positioned at the end element of its outer element 800 */ 801 public static WriteYDPosYHJK_ZJJKResponse parse( 802 javax.xml.stream.XMLStreamReader reader) 803 throws java.lang.Exception { 804 WriteYDPosYHJK_ZJJKResponse object = new WriteYDPosYHJK_ZJJKResponse(); 805 806 int event; 807 javax.xml.namespace.QName currentQName = null; 808 java.lang.String nillableValue = null; 809 java.lang.String prefix = ""; 810 java.lang.String namespaceuri = ""; 811 812 try { 813 while (!reader.isStartElement() && !reader.isEndElement()) 814 reader.next(); 815 816 currentQName = reader.getName(); 817 818 if (reader.getAttributeValue( 819 "http://www.w3.org/2001/XMLSchema-instance", 820 "type") != null) { 821 java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 822 "type"); 823 824 if (fullTypeName != null) { 825 java.lang.String nsPrefix = null; 826 827 if (fullTypeName.indexOf(":") > -1) { 828 nsPrefix = fullTypeName.substring(0, 829 fullTypeName.indexOf(":")); 830 } 831 832 nsPrefix = (nsPrefix == null) ? "" : nsPrefix; 833 834 java.lang.String type = fullTypeName.substring(fullTypeName.indexOf( 835 ":") + 1); 836 837 if (!"writeYDPosYHJK_ZJJKResponse".equals(type)) { 838 //find namespace for the prefix 839 java.lang.String nsUri = reader.getNamespaceContext() 840 .getNamespaceURI(nsPrefix); 841 842 return (WriteYDPosYHJK_ZJJKResponse) ExtensionMapper.getTypeObject(nsUri, 843 type, reader); 844 } 845 } 846 } 847 848 // Note all attributes that were handled. Used to differ normal attributes 849 // from anyAttributes. 850 java.util.Vector handledAttributes = new java.util.Vector(); 851 852 reader.next(); 853 854 while (!reader.isStartElement() && !reader.isEndElement()) 855 reader.next(); 856 857 if ((reader.isStartElement() && 858 new javax.xml.namespace.QName( 859 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws", 860 "writeYDPosYHJK_ZJJKReturn").equals( 861 reader.getName())) || 862 new javax.xml.namespace.QName("", 863 "writeYDPosYHJK_ZJJKReturn").equals( 864 reader.getName())) { 865 nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 866 "nil"); 867 868 if (!"true".equals(nillableValue) && 869 !"1".equals(nillableValue)) { 870 java.lang.String content = reader.getElementText(); 871 872 object.setWriteYDPosYHJK_ZJJKReturn(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 873 content)); 874 } else { 875 reader.getElementText(); // throw away text nodes if any. 876 } 877 878 reader.next(); 879 } // End of if for expected property start element 880 881 else { 882 // 1 - A start element we are not expecting indicates an invalid parameter was passed 883 throw new org.apache.axis2.databinding.ADBException( 884 "Unexpected subelement " + reader.getName()); 885 } 886 887 while (!reader.isStartElement() && !reader.isEndElement()) 888 reader.next(); 889 890 if (reader.isStartElement()) { 891 // 2 - A start element we are not expecting indicates a trailing invalid property 892 throw new org.apache.axis2.databinding.ADBException( 893 "Unexpected subelement " + reader.getName()); 894 } 895 } catch (javax.xml.stream.XMLStreamException e) { 896 throw new java.lang.Exception(e); 897 } 898 899 return object; 900 } 901 } //end of factory class 902 } 903 904 public static class WriteYDPosYHJK_ZJJK implements org.apache.axis2.databinding.ADBBean { 905 public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://DefaultNamespace", 906 "writeYDPosYHJK_ZJJK", "ns2"); 907 908 /** 909 * field for Jkxlh 910 */ 911 protected java.lang.String localJkxlh; 912 913 /** 914 * field for Jkid 915 */ 916 protected java.lang.String localJkid; 917 918 /** 919 * field for WriteXmlDoc 920 */ 921 protected java.lang.String localWriteXmlDoc; 922 923 /** 924 * Auto generated getter method 925 * @return java.lang.String 926 */ 927 public java.lang.String getJkxlh() { 928 return localJkxlh; 929 } 930 931 /** 932 * Auto generated setter method 933 * @param param Jkxlh 934 */ 935 public void setJkxlh(java.lang.String param) { 936 this.localJkxlh = param; 937 } 938 939 /** 940 * Auto generated getter method 941 * @return java.lang.String 942 */ 943 public java.lang.String getJkid() { 944 return localJkid; 945 } 946 947 /** 948 * Auto generated setter method 949 * @param param Jkid 950 */ 951 public void setJkid(java.lang.String param) { 952 this.localJkid = param; 953 } 954 955 /** 956 * Auto generated getter method 957 * @return java.lang.String 958 */ 959 public java.lang.String getWriteXmlDoc() { 960 return localWriteXmlDoc; 961 } 962 963 /** 964 * Auto generated setter method 965 * @param param WriteXmlDoc 966 */ 967 public void setWriteXmlDoc(java.lang.String param) { 968 this.localWriteXmlDoc = param; 969 } 970 971 /** 972 * 973 * @param parentQName 974 * @param factory 975 * @return org.apache.axiom.om.OMElement 976 */ 977 public org.apache.axiom.om.OMElement getOMElement( 978 final javax.xml.namespace.QName parentQName, 979 final org.apache.axiom.om.OMFactory factory) 980 throws org.apache.axis2.databinding.ADBException { 981 return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( 982 this, MY_QNAME)); 983 } 984 985 public void serialize(final javax.xml.namespace.QName parentQName, 986 javax.xml.stream.XMLStreamWriter xmlWriter) 987 throws javax.xml.stream.XMLStreamException, 988 org.apache.axis2.databinding.ADBException { 989 serialize(parentQName, xmlWriter, false); 990 } 991 992 public void serialize(final javax.xml.namespace.QName parentQName, 993 javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) 994 throws javax.xml.stream.XMLStreamException, 995 org.apache.axis2.databinding.ADBException { 996 java.lang.String prefix = null; 997 java.lang.String namespace = null; 998 999 prefix = parentQName.getPrefix(); 1000 namespace = parentQName.getNamespaceURI(); 1001 writeStartElement(prefix, namespace, parentQName.getLocalPart(), 1002 xmlWriter); 1003 1004 if (serializeType) { 1005 java.lang.String namespacePrefix = registerPrefix(xmlWriter, 1006 "http://DefaultNamespace"); 1007 1008 if ((namespacePrefix != null) && 1009 (namespacePrefix.trim().length() > 0)) { 1010 writeAttribute("xsi", 1011 "http://www.w3.org/2001/XMLSchema-instance", "type", 1012 namespacePrefix + ":writeYDPosYHJK_ZJJK", xmlWriter); 1013 } else { 1014 writeAttribute("xsi", 1015 "http://www.w3.org/2001/XMLSchema-instance", "type", 1016 "writeYDPosYHJK_ZJJK", xmlWriter); 1017 } 1018 } 1019 1020 namespace = "http://DefaultNamespace"; 1021 writeStartElement(null, namespace, "jkxlh", xmlWriter); 1022 1023 if (localJkxlh == null) { 1024 // write the nil attribute 1025 writeAttribute("xsi", 1026 "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", 1027 xmlWriter); 1028 } else { 1029 xmlWriter.writeCharacters(localJkxlh); 1030 } 1031 1032 xmlWriter.writeEndElement(); 1033 1034 namespace = "http://DefaultNamespace"; 1035 writeStartElement(null, namespace, "jkid", xmlWriter); 1036 1037 if (localJkid == null) { 1038 // write the nil attribute 1039 writeAttribute("xsi", 1040 "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", 1041 xmlWriter); 1042 } else { 1043 xmlWriter.writeCharacters(localJkid); 1044 } 1045 1046 xmlWriter.writeEndElement(); 1047 1048 namespace = "http://DefaultNamespace"; 1049 writeStartElement(null, namespace, "WriteXmlDoc", xmlWriter); 1050 1051 if (localWriteXmlDoc == null) { 1052 // write the nil attribute 1053 writeAttribute("xsi", 1054 "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", 1055 xmlWriter); 1056 } else { 1057 xmlWriter.writeCharacters(localWriteXmlDoc); 1058 } 1059 1060 xmlWriter.writeEndElement(); 1061 1062 xmlWriter.writeEndElement(); 1063 } 1064 1065 private static java.lang.String generatePrefix( 1066 java.lang.String namespace) { 1067 if (namespace.equals("http://DefaultNamespace")) { 1068 return "ns2"; 1069 } 1070 1071 return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); 1072 } 1073 1074 /** 1075 * Utility method to write an element start tag. 1076 */ 1077 private void writeStartElement(java.lang.String prefix, 1078 java.lang.String namespace, java.lang.String localPart, 1079 javax.xml.stream.XMLStreamWriter xmlWriter) 1080 throws javax.xml.stream.XMLStreamException { 1081 java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); 1082 1083 if (writerPrefix != null) { 1084 xmlWriter.writeStartElement(writerPrefix, localPart, namespace); 1085 } else { 1086 if (namespace.length() == 0) { 1087 prefix = ""; 1088 } else if (prefix == null) { 1089 prefix = generatePrefix(namespace); 1090 } 1091 1092 xmlWriter.writeStartElement(prefix, localPart, namespace); 1093 xmlWriter.writeNamespace(prefix, namespace); 1094 xmlWriter.setPrefix(prefix, namespace); 1095 } 1096 } 1097 1098 /** 1099 * Util method to write an attribute with the ns prefix 1100 */ 1101 private void writeAttribute(java.lang.String prefix, 1102 java.lang.String namespace, java.lang.String attName, 1103 java.lang.String attValue, 1104 javax.xml.stream.XMLStreamWriter xmlWriter) 1105 throws javax.xml.stream.XMLStreamException { 1106 java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); 1107 1108 if (writerPrefix != null) { 1109 xmlWriter.writeAttribute(writerPrefix, namespace, attName, 1110 attValue); 1111 } else { 1112 xmlWriter.writeNamespace(prefix, namespace); 1113 xmlWriter.setPrefix(prefix, namespace); 1114 xmlWriter.writeAttribute(prefix, namespace, attName, attValue); 1115 } 1116 } 1117 1118 /** 1119 * Util method to write an attribute without the ns prefix 1120 */ 1121 private void writeAttribute(java.lang.String namespace, 1122 java.lang.String attName, java.lang.String attValue, 1123 javax.xml.stream.XMLStreamWriter xmlWriter) 1124 throws javax.xml.stream.XMLStreamException { 1125 if (namespace.equals("")) { 1126 xmlWriter.writeAttribute(attName, attValue); 1127 } else { 1128 xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), 1129 namespace, attName, attValue); 1130 } 1131 } 1132 1133 /** 1134 * Util method to write an attribute without the ns prefix 1135 */ 1136 private void writeQNameAttribute(java.lang.String namespace, 1137 java.lang.String attName, javax.xml.namespace.QName qname, 1138 javax.xml.stream.XMLStreamWriter xmlWriter) 1139 throws javax.xml.stream.XMLStreamException { 1140 java.lang.String attributeNamespace = qname.getNamespaceURI(); 1141 java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); 1142 1143 if (attributePrefix == null) { 1144 attributePrefix = registerPrefix(xmlWriter, attributeNamespace); 1145 } 1146 1147 java.lang.String attributeValue; 1148 1149 if (attributePrefix.trim().length() > 0) { 1150 attributeValue = attributePrefix + ":" + qname.getLocalPart(); 1151 } else { 1152 attributeValue = qname.getLocalPart(); 1153 } 1154 1155 if (namespace.equals("")) { 1156 xmlWriter.writeAttribute(attName, attributeValue); 1157 } else { 1158 registerPrefix(xmlWriter, namespace); 1159 xmlWriter.writeAttribute(attributePrefix, namespace, attName, 1160 attributeValue); 1161 } 1162 } 1163 1164 /** 1165 * method to handle Qnames 1166 */ 1167 private void writeQName(javax.xml.namespace.QName qname, 1168 javax.xml.stream.XMLStreamWriter xmlWriter) 1169 throws javax.xml.stream.XMLStreamException { 1170 java.lang.String namespaceURI = qname.getNamespaceURI(); 1171 1172 if (namespaceURI != null) { 1173 java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); 1174 1175 if (prefix == null) { 1176 prefix = generatePrefix(namespaceURI); 1177 xmlWriter.writeNamespace(prefix, namespaceURI); 1178 xmlWriter.setPrefix(prefix, namespaceURI); 1179 } 1180 1181 if (prefix.trim().length() > 0) { 1182 xmlWriter.writeCharacters(prefix + ":" + 1183 org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1184 qname)); 1185 } else { 1186 // i.e this is the default namespace 1187 xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1188 qname)); 1189 } 1190 } else { 1191 xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1192 qname)); 1193 } 1194 } 1195 1196 private void writeQNames(javax.xml.namespace.QName[] qnames, 1197 javax.xml.stream.XMLStreamWriter xmlWriter) 1198 throws javax.xml.stream.XMLStreamException { 1199 if (qnames != null) { 1200 // we have to store this data until last moment since it is not possible to write any 1201 // namespace data after writing the charactor data 1202 java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); 1203 java.lang.String namespaceURI = null; 1204 java.lang.String prefix = null; 1205 1206 for (int i = 0; i < qnames.length; i++) { 1207 if (i > 0) { 1208 stringToWrite.append(" "); 1209 } 1210 1211 namespaceURI = qnames[i].getNamespaceURI(); 1212 1213 if (namespaceURI != null) { 1214 prefix = xmlWriter.getPrefix(namespaceURI); 1215 1216 if ((prefix == null) || (prefix.length() == 0)) { 1217 prefix = generatePrefix(namespaceURI); 1218 xmlWriter.writeNamespace(prefix, namespaceURI); 1219 xmlWriter.setPrefix(prefix, namespaceURI); 1220 } 1221 1222 if (prefix.trim().length() > 0) { 1223 stringToWrite.append(prefix).append(":") 1224 .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1225 qnames[i])); 1226 } else { 1227 stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1228 qnames[i])); 1229 } 1230 } else { 1231 stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1232 qnames[i])); 1233 } 1234 } 1235 1236 xmlWriter.writeCharacters(stringToWrite.toString()); 1237 } 1238 } 1239 1240 /** 1241 * Register a namespace prefix 1242 */ 1243 private java.lang.String registerPrefix( 1244 javax.xml.stream.XMLStreamWriter xmlWriter, 1245 java.lang.String namespace) 1246 throws javax.xml.stream.XMLStreamException { 1247 java.lang.String prefix = xmlWriter.getPrefix(namespace); 1248 1249 if (prefix == null) { 1250 prefix = generatePrefix(namespace); 1251 1252 javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); 1253 1254 while (true) { 1255 java.lang.String uri = nsContext.getNamespaceURI(prefix); 1256 1257 if ((uri == null) || (uri.length() == 0)) { 1258 break; 1259 } 1260 1261 prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); 1262 } 1263 1264 xmlWriter.writeNamespace(prefix, namespace); 1265 xmlWriter.setPrefix(prefix, namespace); 1266 } 1267 1268 return prefix; 1269 } 1270 1271 /** 1272 * Factory class that keeps the parse method 1273 */ 1274 public static class Factory { 1275 private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); 1276 1277 /** 1278 * static method to create the object 1279 * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable 1280 * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element 1281 * Postcondition: If this object is an element, the reader is positioned at its end element 1282 * If this object is a complex type, the reader is positioned at the end element of its outer element 1283 */ 1284 public static WriteYDPosYHJK_ZJJK parse( 1285 javax.xml.stream.XMLStreamReader reader) 1286 throws java.lang.Exception { 1287 WriteYDPosYHJK_ZJJK object = new WriteYDPosYHJK_ZJJK(); 1288 1289 int event; 1290 javax.xml.namespace.QName currentQName = null; 1291 java.lang.String nillableValue = null; 1292 java.lang.String prefix = ""; 1293 java.lang.String namespaceuri = ""; 1294 1295 try { 1296 while (!reader.isStartElement() && !reader.isEndElement()) 1297 reader.next(); 1298 1299 currentQName = reader.getName(); 1300 1301 if (reader.getAttributeValue( 1302 "http://www.w3.org/2001/XMLSchema-instance", 1303 "type") != null) { 1304 java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 1305 "type"); 1306 1307 if (fullTypeName != null) { 1308 java.lang.String nsPrefix = null; 1309 1310 if (fullTypeName.indexOf(":") > -1) { 1311 nsPrefix = fullTypeName.substring(0, 1312 fullTypeName.indexOf(":")); 1313 } 1314 1315 nsPrefix = (nsPrefix == null) ? "" : nsPrefix; 1316 1317 java.lang.String type = fullTypeName.substring(fullTypeName.indexOf( 1318 ":") + 1); 1319 1320 if (!"writeYDPosYHJK_ZJJK".equals(type)) { 1321 //find namespace for the prefix 1322 java.lang.String nsUri = reader.getNamespaceContext() 1323 .getNamespaceURI(nsPrefix); 1324 1325 return (WriteYDPosYHJK_ZJJK) ExtensionMapper.getTypeObject(nsUri, 1326 type, reader); 1327 } 1328 } 1329 } 1330 1331 // Note all attributes that were handled. Used to differ normal attributes 1332 // from anyAttributes. 1333 java.util.Vector handledAttributes = new java.util.Vector(); 1334 1335 reader.next(); 1336 1337 while (!reader.isStartElement() && !reader.isEndElement()) 1338 reader.next(); 1339 1340 if ((reader.isStartElement() && 1341 new javax.xml.namespace.QName( 1342 "http://DefaultNamespace", "jkxlh").equals( 1343 reader.getName())) || 1344 new javax.xml.namespace.QName("", "jkxlh").equals( 1345 reader.getName())) { 1346 nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 1347 "nil"); 1348 1349 if (!"true".equals(nillableValue) && 1350 !"1".equals(nillableValue)) { 1351 java.lang.String content = reader.getElementText(); 1352 1353 object.setJkxlh(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1354 content)); 1355 } else { 1356 reader.getElementText(); // throw away text nodes if any. 1357 } 1358 1359 reader.next(); 1360 } // End of if for expected property start element 1361 1362 else { 1363 // 1 - A start element we are not expecting indicates an invalid parameter was passed 1364 throw new org.apache.axis2.databinding.ADBException( 1365 "Unexpected subelement " + reader.getName()); 1366 } 1367 1368 while (!reader.isStartElement() && !reader.isEndElement()) 1369 reader.next(); 1370 1371 if ((reader.isStartElement() && 1372 new javax.xml.namespace.QName( 1373 "http://DefaultNamespace", "jkid").equals( 1374 reader.getName())) || 1375 new javax.xml.namespace.QName("", "jkid").equals( 1376 reader.getName())) { 1377 nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 1378 "nil"); 1379 1380 if (!"true".equals(nillableValue) && 1381 !"1".equals(nillableValue)) { 1382 java.lang.String content = reader.getElementText(); 1383 1384 object.setJkid(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1385 content)); 1386 } else { 1387 reader.getElementText(); // throw away text nodes if any. 1388 } 1389 1390 reader.next(); 1391 } // End of if for expected property start element 1392 1393 else { 1394 // 1 - A start element we are not expecting indicates an invalid parameter was passed 1395 throw new org.apache.axis2.databinding.ADBException( 1396 "Unexpected subelement " + reader.getName()); 1397 } 1398 1399 while (!reader.isStartElement() && !reader.isEndElement()) 1400 reader.next(); 1401 1402 if ((reader.isStartElement() && 1403 new javax.xml.namespace.QName( 1404 "http://DefaultNamespace", "WriteXmlDoc").equals( 1405 reader.getName())) || 1406 new javax.xml.namespace.QName("", "WriteXmlDoc").equals( 1407 reader.getName())) { 1408 nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 1409 "nil"); 1410 1411 if (!"true".equals(nillableValue) && 1412 !"1".equals(nillableValue)) { 1413 java.lang.String content = reader.getElementText(); 1414 1415 object.setWriteXmlDoc(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1416 content)); 1417 } else { 1418 reader.getElementText(); // throw away text nodes if any. 1419 } 1420 1421 reader.next(); 1422 } // End of if for expected property start element 1423 1424 else { 1425 // 1 - A start element we are not expecting indicates an invalid parameter was passed 1426 throw new org.apache.axis2.databinding.ADBException( 1427 "Unexpected subelement " + reader.getName()); 1428 } 1429 1430 while (!reader.isStartElement() && !reader.isEndElement()) 1431 reader.next(); 1432 1433 if (reader.isStartElement()) { 1434 // 2 - A start element we are not expecting indicates a trailing invalid property 1435 throw new org.apache.axis2.databinding.ADBException( 1436 "Unexpected subelement " + reader.getName()); 1437 } 1438 } catch (javax.xml.stream.XMLStreamException e) { 1439 throw new java.lang.Exception(e); 1440 } 1441 1442 return object; 1443 } 1444 } //end of factory class 1445 } 1446 1447 public static class ExtensionMapper { 1448 public static java.lang.Object getTypeObject( 1449 java.lang.String namespaceURI, java.lang.String typeName, 1450 javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception { 1451 throw new org.apache.axis2.databinding.ADBException( 1452 "Unsupported type " + namespaceURI + " " + typeName); 1453 } 1454 } 1455 1456 public static class WriteYDPosYHJKResponse implements org.apache.axis2.databinding.ADBBean { 1457 public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws", 1458 "writeYDPosYHJKResponse", "ns1"); 1459 1460 /** 1461 * field for WriteYDPosYHJKReturn 1462 */ 1463 protected java.lang.String localWriteYDPosYHJKReturn; 1464 1465 /** 1466 * Auto generated getter method 1467 * @return java.lang.String 1468 */ 1469 public java.lang.String getWriteYDPosYHJKReturn() { 1470 return localWriteYDPosYHJKReturn; 1471 } 1472 1473 /** 1474 * Auto generated setter method 1475 * @param param WriteYDPosYHJKReturn 1476 */ 1477 public void setWriteYDPosYHJKReturn(java.lang.String param) { 1478 this.localWriteYDPosYHJKReturn = param; 1479 } 1480 1481 /** 1482 * 1483 * @param parentQName 1484 * @param factory 1485 * @return org.apache.axiom.om.OMElement 1486 */ 1487 public org.apache.axiom.om.OMElement getOMElement( 1488 final javax.xml.namespace.QName parentQName, 1489 final org.apache.axiom.om.OMFactory factory) 1490 throws org.apache.axis2.databinding.ADBException { 1491 return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( 1492 this, MY_QNAME)); 1493 } 1494 1495 public void serialize(final javax.xml.namespace.QName parentQName, 1496 javax.xml.stream.XMLStreamWriter xmlWriter) 1497 throws javax.xml.stream.XMLStreamException, 1498 org.apache.axis2.databinding.ADBException { 1499 serialize(parentQName, xmlWriter, false); 1500 } 1501 1502 public void serialize(final javax.xml.namespace.QName parentQName, 1503 javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) 1504 throws javax.xml.stream.XMLStreamException, 1505 org.apache.axis2.databinding.ADBException { 1506 java.lang.String prefix = null; 1507 java.lang.String namespace = null; 1508 1509 prefix = parentQName.getPrefix(); 1510 namespace = parentQName.getNamespaceURI(); 1511 writeStartElement(prefix, namespace, parentQName.getLocalPart(), 1512 xmlWriter); 1513 1514 if (serializeType) { 1515 java.lang.String namespacePrefix = registerPrefix(xmlWriter, 1516 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws"); 1517 1518 if ((namespacePrefix != null) && 1519 (namespacePrefix.trim().length() > 0)) { 1520 writeAttribute("xsi", 1521 "http://www.w3.org/2001/XMLSchema-instance", "type", 1522 namespacePrefix + ":writeYDPosYHJKResponse", xmlWriter); 1523 } else { 1524 writeAttribute("xsi", 1525 "http://www.w3.org/2001/XMLSchema-instance", "type", 1526 "writeYDPosYHJKResponse", xmlWriter); 1527 } 1528 } 1529 1530 namespace = "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws"; 1531 writeStartElement(null, namespace, "writeYDPosYHJKReturn", xmlWriter); 1532 1533 if (localWriteYDPosYHJKReturn == null) { 1534 // write the nil attribute 1535 writeAttribute("xsi", 1536 "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", 1537 xmlWriter); 1538 } else { 1539 xmlWriter.writeCharacters(localWriteYDPosYHJKReturn); 1540 } 1541 1542 xmlWriter.writeEndElement(); 1543 1544 xmlWriter.writeEndElement(); 1545 } 1546 1547 private static java.lang.String generatePrefix( 1548 java.lang.String namespace) { 1549 if (namespace.equals( 1550 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws")) { 1551 return "ns1"; 1552 } 1553 1554 return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); 1555 } 1556 1557 /** 1558 * Utility method to write an element start tag. 1559 */ 1560 private void writeStartElement(java.lang.String prefix, 1561 java.lang.String namespace, java.lang.String localPart, 1562 javax.xml.stream.XMLStreamWriter xmlWriter) 1563 throws javax.xml.stream.XMLStreamException { 1564 java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); 1565 1566 if (writerPrefix != null) { 1567 xmlWriter.writeStartElement(writerPrefix, localPart, namespace); 1568 } else { 1569 if (namespace.length() == 0) { 1570 prefix = ""; 1571 } else if (prefix == null) { 1572 prefix = generatePrefix(namespace); 1573 } 1574 1575 xmlWriter.writeStartElement(prefix, localPart, namespace); 1576 xmlWriter.writeNamespace(prefix, namespace); 1577 xmlWriter.setPrefix(prefix, namespace); 1578 } 1579 } 1580 1581 /** 1582 * Util method to write an attribute with the ns prefix 1583 */ 1584 private void writeAttribute(java.lang.String prefix, 1585 java.lang.String namespace, java.lang.String attName, 1586 java.lang.String attValue, 1587 javax.xml.stream.XMLStreamWriter xmlWriter) 1588 throws javax.xml.stream.XMLStreamException { 1589 java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); 1590 1591 if (writerPrefix != null) { 1592 xmlWriter.writeAttribute(writerPrefix, namespace, attName, 1593 attValue); 1594 } else { 1595 xmlWriter.writeNamespace(prefix, namespace); 1596 xmlWriter.setPrefix(prefix, namespace); 1597 xmlWriter.writeAttribute(prefix, namespace, attName, attValue); 1598 } 1599 } 1600 1601 /** 1602 * Util method to write an attribute without the ns prefix 1603 */ 1604 private void writeAttribute(java.lang.String namespace, 1605 java.lang.String attName, java.lang.String attValue, 1606 javax.xml.stream.XMLStreamWriter xmlWriter) 1607 throws javax.xml.stream.XMLStreamException { 1608 if (namespace.equals("")) { 1609 xmlWriter.writeAttribute(attName, attValue); 1610 } else { 1611 xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), 1612 namespace, attName, attValue); 1613 } 1614 } 1615 1616 /** 1617 * Util method to write an attribute without the ns prefix 1618 */ 1619 private void writeQNameAttribute(java.lang.String namespace, 1620 java.lang.String attName, javax.xml.namespace.QName qname, 1621 javax.xml.stream.XMLStreamWriter xmlWriter) 1622 throws javax.xml.stream.XMLStreamException { 1623 java.lang.String attributeNamespace = qname.getNamespaceURI(); 1624 java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); 1625 1626 if (attributePrefix == null) { 1627 attributePrefix = registerPrefix(xmlWriter, attributeNamespace); 1628 } 1629 1630 java.lang.String attributeValue; 1631 1632 if (attributePrefix.trim().length() > 0) { 1633 attributeValue = attributePrefix + ":" + qname.getLocalPart(); 1634 } else { 1635 attributeValue = qname.getLocalPart(); 1636 } 1637 1638 if (namespace.equals("")) { 1639 xmlWriter.writeAttribute(attName, attributeValue); 1640 } else { 1641 registerPrefix(xmlWriter, namespace); 1642 xmlWriter.writeAttribute(attributePrefix, namespace, attName, 1643 attributeValue); 1644 } 1645 } 1646 1647 /** 1648 * method to handle Qnames 1649 */ 1650 private void writeQName(javax.xml.namespace.QName qname, 1651 javax.xml.stream.XMLStreamWriter xmlWriter) 1652 throws javax.xml.stream.XMLStreamException { 1653 java.lang.String namespaceURI = qname.getNamespaceURI(); 1654 1655 if (namespaceURI != null) { 1656 java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); 1657 1658 if (prefix == null) { 1659 prefix = generatePrefix(namespaceURI); 1660 xmlWriter.writeNamespace(prefix, namespaceURI); 1661 xmlWriter.setPrefix(prefix, namespaceURI); 1662 } 1663 1664 if (prefix.trim().length() > 0) { 1665 xmlWriter.writeCharacters(prefix + ":" + 1666 org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1667 qname)); 1668 } else { 1669 // i.e this is the default namespace 1670 xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1671 qname)); 1672 } 1673 } else { 1674 xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1675 qname)); 1676 } 1677 } 1678 1679 private void writeQNames(javax.xml.namespace.QName[] qnames, 1680 javax.xml.stream.XMLStreamWriter xmlWriter) 1681 throws javax.xml.stream.XMLStreamException { 1682 if (qnames != null) { 1683 // we have to store this data until last moment since it is not possible to write any 1684 // namespace data after writing the charactor data 1685 java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); 1686 java.lang.String namespaceURI = null; 1687 java.lang.String prefix = null; 1688 1689 for (int i = 0; i < qnames.length; i++) { 1690 if (i > 0) { 1691 stringToWrite.append(" "); 1692 } 1693 1694 namespaceURI = qnames[i].getNamespaceURI(); 1695 1696 if (namespaceURI != null) { 1697 prefix = xmlWriter.getPrefix(namespaceURI); 1698 1699 if ((prefix == null) || (prefix.length() == 0)) { 1700 prefix = generatePrefix(namespaceURI); 1701 xmlWriter.writeNamespace(prefix, namespaceURI); 1702 xmlWriter.setPrefix(prefix, namespaceURI); 1703 } 1704 1705 if (prefix.trim().length() > 0) { 1706 stringToWrite.append(prefix).append(":") 1707 .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1708 qnames[i])); 1709 } else { 1710 stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1711 qnames[i])); 1712 } 1713 } else { 1714 stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1715 qnames[i])); 1716 } 1717 } 1718 1719 xmlWriter.writeCharacters(stringToWrite.toString()); 1720 } 1721 } 1722 1723 /** 1724 * Register a namespace prefix 1725 */ 1726 private java.lang.String registerPrefix( 1727 javax.xml.stream.XMLStreamWriter xmlWriter, 1728 java.lang.String namespace) 1729 throws javax.xml.stream.XMLStreamException { 1730 java.lang.String prefix = xmlWriter.getPrefix(namespace); 1731 1732 if (prefix == null) { 1733 prefix = generatePrefix(namespace); 1734 1735 javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); 1736 1737 while (true) { 1738 java.lang.String uri = nsContext.getNamespaceURI(prefix); 1739 1740 if ((uri == null) || (uri.length() == 0)) { 1741 break; 1742 } 1743 1744 prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); 1745 } 1746 1747 xmlWriter.writeNamespace(prefix, namespace); 1748 xmlWriter.setPrefix(prefix, namespace); 1749 } 1750 1751 return prefix; 1752 } 1753 1754 /** 1755 * Factory class that keeps the parse method 1756 */ 1757 public static class Factory { 1758 private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); 1759 1760 /** 1761 * static method to create the object 1762 * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable 1763 * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element 1764 * Postcondition: If this object is an element, the reader is positioned at its end element 1765 * If this object is a complex type, the reader is positioned at the end element of its outer element 1766 */ 1767 public static WriteYDPosYHJKResponse parse( 1768 javax.xml.stream.XMLStreamReader reader) 1769 throws java.lang.Exception { 1770 WriteYDPosYHJKResponse object = new WriteYDPosYHJKResponse(); 1771 1772 int event; 1773 javax.xml.namespace.QName currentQName = null; 1774 java.lang.String nillableValue = null; 1775 java.lang.String prefix = ""; 1776 java.lang.String namespaceuri = ""; 1777 1778 try { 1779 while (!reader.isStartElement() && !reader.isEndElement()) 1780 reader.next(); 1781 1782 currentQName = reader.getName(); 1783 1784 if (reader.getAttributeValue( 1785 "http://www.w3.org/2001/XMLSchema-instance", 1786 "type") != null) { 1787 java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 1788 "type"); 1789 1790 if (fullTypeName != null) { 1791 java.lang.String nsPrefix = null; 1792 1793 if (fullTypeName.indexOf(":") > -1) { 1794 nsPrefix = fullTypeName.substring(0, 1795 fullTypeName.indexOf(":")); 1796 } 1797 1798 nsPrefix = (nsPrefix == null) ? "" : nsPrefix; 1799 1800 java.lang.String type = fullTypeName.substring(fullTypeName.indexOf( 1801 ":") + 1); 1802 1803 if (!"writeYDPosYHJKResponse".equals(type)) { 1804 //find namespace for the prefix 1805 java.lang.String nsUri = reader.getNamespaceContext() 1806 .getNamespaceURI(nsPrefix); 1807 1808 return (WriteYDPosYHJKResponse) ExtensionMapper.getTypeObject(nsUri, 1809 type, reader); 1810 } 1811 } 1812 } 1813 1814 // Note all attributes that were handled. Used to differ normal attributes 1815 // from anyAttributes. 1816 java.util.Vector handledAttributes = new java.util.Vector(); 1817 1818 reader.next(); 1819 1820 while (!reader.isStartElement() && !reader.isEndElement()) 1821 reader.next(); 1822 1823 if ((reader.isStartElement() && 1824 new javax.xml.namespace.QName( 1825 "http://10.176.133.7:9080/zhptkzb/services/CarrySLPOS.jws", 1826 "writeYDPosYHJKReturn").equals(reader.getName())) || 1827 new javax.xml.namespace.QName("", 1828 "writeYDPosYHJKReturn").equals(reader.getName())) { 1829 nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 1830 "nil"); 1831 1832 if (!"true".equals(nillableValue) && 1833 !"1".equals(nillableValue)) { 1834 java.lang.String content = reader.getElementText(); 1835 1836 object.setWriteYDPosYHJKReturn(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 1837 content)); 1838 } else { 1839 reader.getElementText(); // throw away text nodes if any. 1840 } 1841 1842 reader.next(); 1843 } // End of if for expected property start element 1844 1845 else { 1846 // 1 - A start element we are not expecting indicates an invalid parameter was passed 1847 throw new org.apache.axis2.databinding.ADBException( 1848 "Unexpected subelement " + reader.getName()); 1849 } 1850 1851 while (!reader.isStartElement() && !reader.isEndElement()) 1852 reader.next(); 1853 1854 if (reader.isStartElement()) { 1855 // 2 - A start element we are not expecting indicates a trailing invalid property 1856 throw new org.apache.axis2.databinding.ADBException( 1857 "Unexpected subelement " + reader.getName()); 1858 } 1859 } catch (javax.xml.stream.XMLStreamException e) { 1860 throw new java.lang.Exception(e); 1861 } 1862 1863 return object; 1864 } 1865 } //end of factory class 1866 } 1867 1868 public static class WriteYDPosYHJK implements org.apache.axis2.databinding.ADBBean { 1869 public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://DefaultNamespace", 1870 "writeYDPosYHJK", "ns2"); 1871 1872 /** 1873 * field for Jkxlh 1874 */ 1875 protected java.lang.String localJkxlh; 1876 1877 /** 1878 * field for Jkid 1879 */ 1880 protected java.lang.String localJkid; 1881 1882 /** 1883 * field for WriteXmlDoc 1884 */ 1885 protected java.lang.String localWriteXmlDoc; 1886 1887 /** 1888 * Auto generated getter method 1889 * @return java.lang.String 1890 */ 1891 public java.lang.String getJkxlh() { 1892 return localJkxlh; 1893 } 1894 1895 /** 1896 * Auto generated setter method 1897 * @param param Jkxlh 1898 */ 1899 public void setJkxlh(java.lang.String param) { 1900 this.localJkxlh = param; 1901 } 1902 1903 /** 1904 * Auto generated getter method 1905 * @return java.lang.String 1906 */ 1907 public java.lang.String getJkid() { 1908 return localJkid; 1909 } 1910 1911 /** 1912 * Auto generated setter method 1913 * @param param Jkid 1914 */ 1915 public void setJkid(java.lang.String param) { 1916 this.localJkid = param; 1917 } 1918 1919 /** 1920 * Auto generated getter method 1921 * @return java.lang.String 1922 */ 1923 public java.lang.String getWriteXmlDoc() { 1924 return localWriteXmlDoc; 1925 } 1926 1927 /** 1928 * Auto generated setter method 1929 * @param param WriteXmlDoc 1930 */ 1931 public void setWriteXmlDoc(java.lang.String param) { 1932 this.localWriteXmlDoc = param; 1933 } 1934 1935 /** 1936 * 1937 * @param parentQName 1938 * @param factory 1939 * @return org.apache.axiom.om.OMElement 1940 */ 1941 public org.apache.axiom.om.OMElement getOMElement( 1942 final javax.xml.namespace.QName parentQName, 1943 final org.apache.axiom.om.OMFactory factory) 1944 throws org.apache.axis2.databinding.ADBException { 1945 return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( 1946 this, MY_QNAME)); 1947 } 1948 1949 public void serialize(final javax.xml.namespace.QName parentQName, 1950 javax.xml.stream.XMLStreamWriter xmlWriter) 1951 throws javax.xml.stream.XMLStreamException, 1952 org.apache.axis2.databinding.ADBException { 1953 serialize(parentQName, xmlWriter, false); 1954 } 1955 1956 public void serialize(final javax.xml.namespace.QName parentQName, 1957 javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) 1958 throws javax.xml.stream.XMLStreamException, 1959 org.apache.axis2.databinding.ADBException { 1960 java.lang.String prefix = null; 1961 java.lang.String namespace = null; 1962 1963 prefix = parentQName.getPrefix(); 1964 namespace = parentQName.getNamespaceURI(); 1965 writeStartElement(prefix, namespace, parentQName.getLocalPart(), 1966 xmlWriter); 1967 1968 if (serializeType) { 1969 java.lang.String namespacePrefix = registerPrefix(xmlWriter, 1970 "http://DefaultNamespace"); 1971 1972 if ((namespacePrefix != null) && 1973 (namespacePrefix.trim().length() > 0)) { 1974 writeAttribute("xsi", 1975 "http://www.w3.org/2001/XMLSchema-instance", "type", 1976 namespacePrefix + ":writeYDPosYHJK", xmlWriter); 1977 } else { 1978 writeAttribute("xsi", 1979 "http://www.w3.org/2001/XMLSchema-instance", "type", 1980 "writeYDPosYHJK", xmlWriter); 1981 } 1982 } 1983 1984 namespace = "http://DefaultNamespace"; 1985 writeStartElement(null, namespace, "jkxlh", xmlWriter); 1986 1987 if (localJkxlh == null) { 1988 // write the nil attribute 1989 writeAttribute("xsi", 1990 "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", 1991 xmlWriter); 1992 } else { 1993 xmlWriter.writeCharacters(localJkxlh); 1994 } 1995 1996 xmlWriter.writeEndElement(); 1997 1998 namespace = "http://DefaultNamespace"; 1999 writeStartElement(null, namespace, "jkid", xmlWriter); 2000 2001 if (localJkid == null) { 2002 // write the nil attribute 2003 writeAttribute("xsi", 2004 "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", 2005 xmlWriter); 2006 } else { 2007 xmlWriter.writeCharacters(localJkid); 2008 } 2009 2010 xmlWriter.writeEndElement(); 2011 2012 namespace = "http://DefaultNamespace"; 2013 writeStartElement(null, namespace, "WriteXmlDoc", xmlWriter); 2014 2015 if (localWriteXmlDoc == null) { 2016 // write the nil attribute 2017 writeAttribute("xsi", 2018 "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", 2019 xmlWriter); 2020 } else { 2021 xmlWriter.writeCharacters(localWriteXmlDoc); 2022 } 2023 2024 xmlWriter.writeEndElement(); 2025 2026 xmlWriter.writeEndElement(); 2027 } 2028 2029 private static java.lang.String generatePrefix( 2030 java.lang.String namespace) { 2031 if (namespace.equals("http://DefaultNamespace")) { 2032 return "ns2"; 2033 } 2034 2035 return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); 2036 } 2037 2038 /** 2039 * Utility method to write an element start tag. 2040 */ 2041 private void writeStartElement(java.lang.String prefix, 2042 java.lang.String namespace, java.lang.String localPart, 2043 javax.xml.stream.XMLStreamWriter xmlWriter) 2044 throws javax.xml.stream.XMLStreamException { 2045 java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); 2046 2047 if (writerPrefix != null) { 2048 xmlWriter.writeStartElement(writerPrefix, localPart, namespace); 2049 } else { 2050 if (namespace.length() == 0) { 2051 prefix = ""; 2052 } else if (prefix == null) { 2053 prefix = generatePrefix(namespace); 2054 } 2055 2056 xmlWriter.writeStartElement(prefix, localPart, namespace); 2057 xmlWriter.writeNamespace(prefix, namespace); 2058 xmlWriter.setPrefix(prefix, namespace); 2059 } 2060 } 2061 2062 /** 2063 * Util method to write an attribute with the ns prefix 2064 */ 2065 private void writeAttribute(java.lang.String prefix, 2066 java.lang.String namespace, java.lang.String attName, 2067 java.lang.String attValue, 2068 javax.xml.stream.XMLStreamWriter xmlWriter) 2069 throws javax.xml.stream.XMLStreamException { 2070 java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); 2071 2072 if (writerPrefix != null) { 2073 xmlWriter.writeAttribute(writerPrefix, namespace, attName, 2074 attValue); 2075 } else { 2076 xmlWriter.writeNamespace(prefix, namespace); 2077 xmlWriter.setPrefix(prefix, namespace); 2078 xmlWriter.writeAttribute(prefix, namespace, attName, attValue); 2079 } 2080 } 2081 2082 /** 2083 * Util method to write an attribute without the ns prefix 2084 */ 2085 private void writeAttribute(java.lang.String namespace, 2086 java.lang.String attName, java.lang.String attValue, 2087 javax.xml.stream.XMLStreamWriter xmlWriter) 2088 throws javax.xml.stream.XMLStreamException { 2089 if (namespace.equals("")) { 2090 xmlWriter.writeAttribute(attName, attValue); 2091 } else { 2092 xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), 2093 namespace, attName, attValue); 2094 } 2095 } 2096 2097 /** 2098 * Util method to write an attribute without the ns prefix 2099 */ 2100 private void writeQNameAttribute(java.lang.String namespace, 2101 java.lang.String attName, javax.xml.namespace.QName qname, 2102 javax.xml.stream.XMLStreamWriter xmlWriter) 2103 throws javax.xml.stream.XMLStreamException { 2104 java.lang.String attributeNamespace = qname.getNamespaceURI(); 2105 java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); 2106 2107 if (attributePrefix == null) { 2108 attributePrefix = registerPrefix(xmlWriter, attributeNamespace); 2109 } 2110 2111 java.lang.String attributeValue; 2112 2113 if (attributePrefix.trim().length() > 0) { 2114 attributeValue = attributePrefix + ":" + qname.getLocalPart(); 2115 } else { 2116 attributeValue = qname.getLocalPart(); 2117 } 2118 2119 if (namespace.equals("")) { 2120 xmlWriter.writeAttribute(attName, attributeValue); 2121 } else { 2122 registerPrefix(xmlWriter, namespace); 2123 xmlWriter.writeAttribute(attributePrefix, namespace, attName, 2124 attributeValue); 2125 } 2126 } 2127 2128 /** 2129 * method to handle Qnames 2130 */ 2131 private void writeQName(javax.xml.namespace.QName qname, 2132 javax.xml.stream.XMLStreamWriter xmlWriter) 2133 throws javax.xml.stream.XMLStreamException { 2134 java.lang.String namespaceURI = qname.getNamespaceURI(); 2135 2136 if (namespaceURI != null) { 2137 java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); 2138 2139 if (prefix == null) { 2140 prefix = generatePrefix(namespaceURI); 2141 xmlWriter.writeNamespace(prefix, namespaceURI); 2142 xmlWriter.setPrefix(prefix, namespaceURI); 2143 } 2144 2145 if (prefix.trim().length() > 0) { 2146 xmlWriter.writeCharacters(prefix + ":" + 2147 org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 2148 qname)); 2149 } else { 2150 // i.e this is the default namespace 2151 xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 2152 qname)); 2153 } 2154 } else { 2155 xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 2156 qname)); 2157 } 2158 } 2159 2160 private void writeQNames(javax.xml.namespace.QName[] qnames, 2161 javax.xml.stream.XMLStreamWriter xmlWriter) 2162 throws javax.xml.stream.XMLStreamException { 2163 if (qnames != null) { 2164 // we have to store this data until last moment since it is not possible to write any 2165 // namespace data after writing the charactor data 2166 java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); 2167 java.lang.String namespaceURI = null; 2168 java.lang.String prefix = null; 2169 2170 for (int i = 0; i < qnames.length; i++) { 2171 if (i > 0) { 2172 stringToWrite.append(" "); 2173 } 2174 2175 namespaceURI = qnames[i].getNamespaceURI(); 2176 2177 if (namespaceURI != null) { 2178 prefix = xmlWriter.getPrefix(namespaceURI); 2179 2180 if ((prefix == null) || (prefix.length() == 0)) { 2181 prefix = generatePrefix(namespaceURI); 2182 xmlWriter.writeNamespace(prefix, namespaceURI); 2183 xmlWriter.setPrefix(prefix, namespaceURI); 2184 } 2185 2186 if (prefix.trim().length() > 0) { 2187 stringToWrite.append(prefix).append(":") 2188 .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 2189 qnames[i])); 2190 } else { 2191 stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 2192 qnames[i])); 2193 } 2194 } else { 2195 stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 2196 qnames[i])); 2197 } 2198 } 2199 2200 xmlWriter.writeCharacters(stringToWrite.toString()); 2201 } 2202 } 2203 2204 /** 2205 * Register a namespace prefix 2206 */ 2207 private java.lang.String registerPrefix( 2208 javax.xml.stream.XMLStreamWriter xmlWriter, 2209 java.lang.String namespace) 2210 throws javax.xml.stream.XMLStreamException { 2211 java.lang.String prefix = xmlWriter.getPrefix(namespace); 2212 2213 if (prefix == null) { 2214 prefix = generatePrefix(namespace); 2215 2216 javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); 2217 2218 while (true) { 2219 java.lang.String uri = nsContext.getNamespaceURI(prefix); 2220 2221 if ((uri == null) || (uri.length() == 0)) { 2222 break; 2223 } 2224 2225 prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); 2226 } 2227 2228 xmlWriter.writeNamespace(prefix, namespace); 2229 xmlWriter.setPrefix(prefix, namespace); 2230 } 2231 2232 return prefix; 2233 } 2234 2235 /** 2236 * Factory class that keeps the parse method 2237 */ 2238 public static class Factory { 2239 private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); 2240 2241 /** 2242 * static method to create the object 2243 * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable 2244 * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element 2245 * Postcondition: If this object is an element, the reader is positioned at its end element 2246 * If this object is a complex type, the reader is positioned at the end element of its outer element 2247 */ 2248 public static WriteYDPosYHJK parse( 2249 javax.xml.stream.XMLStreamReader reader) 2250 throws java.lang.Exception { 2251 WriteYDPosYHJK object = new WriteYDPosYHJK(); 2252 2253 int event; 2254 javax.xml.namespace.QName currentQName = null; 2255 java.lang.String nillableValue = null; 2256 java.lang.String prefix = ""; 2257 java.lang.String namespaceuri = ""; 2258 2259 try { 2260 while (!reader.isStartElement() && !reader.isEndElement()) 2261 reader.next(); 2262 2263 currentQName = reader.getName(); 2264 2265 if (reader.getAttributeValue( 2266 "http://www.w3.org/2001/XMLSchema-instance", 2267 "type") != null) { 2268 java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 2269 "type"); 2270 2271 if (fullTypeName != null) { 2272 java.lang.String nsPrefix = null; 2273 2274 if (fullTypeName.indexOf(":") > -1) { 2275 nsPrefix = fullTypeName.substring(0, 2276 fullTypeName.indexOf(":")); 2277 } 2278 2279 nsPrefix = (nsPrefix == null) ? "" : nsPrefix; 2280 2281 java.lang.String type = fullTypeName.substring(fullTypeName.indexOf( 2282 ":") + 1); 2283 2284 if (!"writeYDPosYHJK".equals(type)) { 2285 //find namespace for the prefix 2286 java.lang.String nsUri = reader.getNamespaceContext() 2287 .getNamespaceURI(nsPrefix); 2288 2289 return (WriteYDPosYHJK) ExtensionMapper.getTypeObject(nsUri, 2290 type, reader); 2291 } 2292 } 2293 } 2294 2295 // Note all attributes that were handled. Used to differ normal attributes 2296 // from anyAttributes. 2297 java.util.Vector handledAttributes = new java.util.Vector(); 2298 2299 reader.next(); 2300 2301 while (!reader.isStartElement() && !reader.isEndElement()) 2302 reader.next(); 2303 2304 if ((reader.isStartElement() && 2305 new javax.xml.namespace.QName( 2306 "http://DefaultNamespace", "jkxlh").equals( 2307 reader.getName())) || 2308 new javax.xml.namespace.QName("", "jkxlh").equals( 2309 reader.getName())) { 2310 nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 2311 "nil"); 2312 2313 if (!"true".equals(nillableValue) && 2314 !"1".equals(nillableValue)) { 2315 java.lang.String content = reader.getElementText(); 2316 2317 object.setJkxlh(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 2318 content)); 2319 } else { 2320 reader.getElementText(); // throw away text nodes if any. 2321 } 2322 2323 reader.next(); 2324 } // End of if for expected property start element 2325 2326 else { 2327 // 1 - A start element we are not expecting indicates an invalid parameter was passed 2328 throw new org.apache.axis2.databinding.ADBException( 2329 "Unexpected subelement " + reader.getName()); 2330 } 2331 2332 while (!reader.isStartElement() && !reader.isEndElement()) 2333 reader.next(); 2334 2335 if ((reader.isStartElement() && 2336 new javax.xml.namespace.QName( 2337 "http://DefaultNamespace", "jkid").equals( 2338 reader.getName())) || 2339 new javax.xml.namespace.QName("", "jkid").equals( 2340 reader.getName())) { 2341 nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 2342 "nil"); 2343 2344 if (!"true".equals(nillableValue) && 2345 !"1".equals(nillableValue)) { 2346 java.lang.String content = reader.getElementText(); 2347 2348 object.setJkid(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 2349 content)); 2350 } else { 2351 reader.getElementText(); // throw away text nodes if any. 2352 } 2353 2354 reader.next(); 2355 } // End of if for expected property start element 2356 2357 else { 2358 // 1 - A start element we are not expecting indicates an invalid parameter was passed 2359 throw new org.apache.axis2.databinding.ADBException( 2360 "Unexpected subelement " + reader.getName()); 2361 } 2362 2363 while (!reader.isStartElement() && !reader.isEndElement()) 2364 reader.next(); 2365 2366 if ((reader.isStartElement() && 2367 new javax.xml.namespace.QName( 2368 "http://DefaultNamespace", "WriteXmlDoc").equals( 2369 reader.getName())) || 2370 new javax.xml.namespace.QName("", "WriteXmlDoc").equals( 2371 reader.getName())) { 2372 nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", 2373 "nil"); 2374 2375 if (!"true".equals(nillableValue) && 2376 !"1".equals(nillableValue)) { 2377 java.lang.String content = reader.getElementText(); 2378 2379 object.setWriteXmlDoc(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( 2380 content)); 2381 } else { 2382 reader.getElementText(); // throw away text nodes if any. 2383 } 2384 2385 reader.next(); 2386 } // End of if for expected property start element 2387 2388 else { 2389 // 1 - A start element we are not expecting indicates an invalid parameter was passed 2390 throw new org.apache.axis2.databinding.ADBException( 2391 "Unexpected subelement " + reader.getName()); 2392 } 2393 2394 while (!reader.isStartElement() && !reader.isEndElement()) 2395 reader.next(); 2396 2397 if (reader.isStartElement()) { 2398 // 2 - A start element we are not expecting indicates a trailing invalid property 2399 throw new org.apache.axis2.databinding.ADBException( 2400 "Unexpected subelement " + reader.getName()); 2401 } 2402 } catch (javax.xml.stream.XMLStreamException e) { 2403 throw new java.lang.Exception(e); 2404 } 2405 2406 return object; 2407 } 2408 } //end of factory class 2409 } 2410 }
axis2生成webservice客户端代码--commond
原文:http://www.cnblogs.com/hutton/p/5199343.html