/* * This method must invoke the correct method on the servant based on the opcode. */ protected void processingHook(StreamingHandlerState state) throws Exception { switch (state.getRequest().getOperationCode()) { case approveObjects_OPCODE: invoke_approveObjects(state); break; case removeObjects_OPCODE: invoke_removeObjects(state); break; case updateObjects_OPCODE: invoke_updateObjects(state); break; case submitObjects_OPCODE: invoke_submitObjects(state); break; case undeprecateObjects_OPCODE: invoke_undeprecateObjects(state); break; case deprecateObjects_OPCODE: invoke_deprecateObjects(state); break; default: throw new SOAPProtocolViolationException( "soap.operation.unrecognized", Integer.toString(state.getRequest().getOperationCode())); } }
/* * This method does the actual method invocation for operation: removeObjects */ private void invoke_removeObjects(StreamingHandlerState state) throws Exception { javax.xml.soap.SOAPElement mySOAPElement = null; Object mySOAPElementObj = state.getRequest().getBody().getValue(); if (mySOAPElementObj instanceof SOAPDeserializationState) { mySOAPElement = (javax.xml.soap.SOAPElement) ((SOAPDeserializationState) mySOAPElementObj).getInstance(); } else { mySOAPElement = (javax.xml.soap.SOAPElement) mySOAPElementObj; } try { javax.xml.soap.SOAPElement partRegistryResponse = ((org.freebxml.omar.common.jaxrpc.registry.server.LifeCycleManagerPortType) getTarget()) .removeObjects(mySOAPElement); SOAPHeaderBlockInfo headerInfo; javax.xml.soap.SOAPElement _response = partRegistryResponse; SOAPBlockInfo bodyBlock = new SOAPBlockInfo(ns2_removeObjects_RegistryResponse_QNAME); bodyBlock.setValue(_response); bodyBlock.setSerializer(ns2_ns2_RegistryResponseType_TYPE_QNAME_Serializer); state.getResponse().setBody(bodyBlock); } catch (javax.xml.rpc.soap.SOAPFaultException e) { SOAPFaultInfo fault = new SOAPFaultInfo(e.getFaultCode(), e.getFaultString(), e.getFaultActor(), e.getDetail()); SOAPBlockInfo faultBlock = new SOAPBlockInfo(com.sun.xml.rpc.encoding.soap.SOAPConstants.QNAME_SOAP_FAULT); faultBlock.setValue(fault); faultBlock.setSerializer(new SOAPFaultInfoSerializer(false, e.getDetail() == null)); state.getResponse().setBody(faultBlock); state.getResponse().setFailure(true); } }
private void getNonExplicitAttachment(StreamingHandlerState state) throws Exception { javax.xml.rpc.handler.soap.SOAPMessageContext smc = state.getMessageContext(); javax.xml.soap.SOAPMessage message = state.getRequest().getMessage(); java.util.ArrayList attachments = null; for (java.util.Iterator iter = message.getAttachments(); iter.hasNext(); ) { if (attachments == null) { attachments = new java.util.ArrayList(); } attachments.add(iter.next()); } smc.setProperty( com.sun.xml.rpc.server.ServerPropertyConstants.GET_ATTACHMENT_PROPERTY, attachments); }
/* * this method deserializes the request/response structure in the body */ protected void readFirstBodyElement( XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingHandlerState state) throws Exception { int opcode = state.getRequest().getOperationCode(); switch (opcode) { case approveObjects_OPCODE: deserialize_approveObjects(bodyReader, deserializationContext, state); break; case removeObjects_OPCODE: deserialize_removeObjects(bodyReader, deserializationContext, state); break; case updateObjects_OPCODE: deserialize_updateObjects(bodyReader, deserializationContext, state); break; case submitObjects_OPCODE: deserialize_submitObjects(bodyReader, deserializationContext, state); break; case undeprecateObjects_OPCODE: deserialize_undeprecateObjects(bodyReader, deserializationContext, state); break; case deprecateObjects_OPCODE: deserialize_deprecateObjects(bodyReader, deserializationContext, state); break; default: throw new SOAPProtocolViolationException( "soap.operation.unrecognized", Integer.toString(opcode)); } }
protected void postEnvelopeReadingHook(StreamingHandlerState state) throws Exception { super.postEnvelopeReadingHook(state); switch (state.getRequest().getOperationCode()) { case updateObjects_OPCODE: getNonExplicitAttachment(state); break; case submitObjects_OPCODE: getNonExplicitAttachment(state); break; } }
/* * This method deserializes the body of the deprecateObjects operation. */ private void deserialize_deprecateObjects( XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingHandlerState state) throws Exception { Object mySOAPElementObj = ns1_ns1_AdhocQueryRequest_TYPE_QNAME_Serializer.deserialize( ns3_deprecateObjects_DeprecateObjectsRequest_QNAME, bodyReader, deserializationContext); SOAPBlockInfo bodyBlock = new SOAPBlockInfo(ns3_deprecateObjects_DeprecateObjectsRequest_QNAME); bodyBlock.setValue(mySOAPElementObj); state.getRequest().setBody(bodyBlock); }
/* * This method must determine the opcode of the operation that has been invoked. */ protected void peekFirstBodyElement( XMLReader bodyReader, SOAPDeserializationContext deserializationContext, StreamingHandlerState state) throws Exception { if (bodyReader.getName().equals(ns3_approveObjects_ApproveObjectsRequest_QNAME)) { state.getRequest().setOperationCode(approveObjects_OPCODE); } else if (bodyReader.getName().equals(ns3_removeObjects_RemoveObjectsRequest_QNAME)) { state.getRequest().setOperationCode(removeObjects_OPCODE); } else if (bodyReader.getName().equals(ns3_updateObjects_UpdateObjectsRequest_QNAME)) { state.getRequest().setOperationCode(updateObjects_OPCODE); } else if (bodyReader.getName().equals(ns3_submitObjects_SubmitObjectsRequest_QNAME)) { state.getRequest().setOperationCode(submitObjects_OPCODE); } else if (bodyReader .getName() .equals(ns3_undeprecateObjects_UndeprecateObjectsRequest_QNAME)) { state.getRequest().setOperationCode(undeprecateObjects_OPCODE); } else if (bodyReader.getName().equals(ns3_deprecateObjects_DeprecateObjectsRequest_QNAME)) { state.getRequest().setOperationCode(deprecateObjects_OPCODE); } else { throw new SOAPProtocolViolationException( "soap.operation.unrecognized", bodyReader.getName().toString()); } }